patgraph
Graph data structure library
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Passing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install patgraph
choosenim install patgraph
git clone https://github.com/planetis-m/patgraph
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| patgraph | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/planetis-m/patgraph |
|---|---|
| Homepage | https://github.com/planetis-m/patgraph |
| Documentation | View Documentation |
| Registry Source | nimble_official |
README
Patgraph — graph data structure library for Nim
About
This nimble package contains a Graph[N, E] graph datastructure using an adjacency list representation.
It is based on petgraph's library.
Example
import patgraph
var graph: Graph[string, float]
let nodeA = graph.addNode("a")
let nodeB = graph.addNode("b")
let nodeC = graph.addNode("c")
let nodeD = graph.addNode("d")
let nodeE = graph.addNode("e")
let nodeF = graph.addNode("f")
let nodeG = graph.addNode("g")
let nodeH = graph.addNode("h")
graph.extendWithEdges([
(nodeA, nodeB, 0.0),
(nodeA, nodeC, 0.25),
(nodeB, nodeD, 0.5),
(nodeB, nodeE, 0.75),
(nodeC, nodeF, 1.0),
(nodeC, nodeG, 1.25),
(nodeE, nodeF, 1.5),
(nodeE, nodeH, 1.75),
(nodeF, nodeG, 2.0)])
echo graph
# a -> [c: 0.25, b: 0.0]
# b -> [e: 0.75, d: 0.5]
# c -> [g: 1.25, f: 1.0]
# d -> []
# e -> [h: 1.75, f: 1.5]
# f -> [g: 2.0]
# g -> []
# h -> []
for n in graph.neighbors(nodeC):
echo graph[n]
# g
# f
License
This library is distributed under the MIT license. For more information see LICENSE.