Utilities · zero-dependency · MIT

larzgraph

Graph algorithms.

Directed and undirected graphs with BFS/DFS, Dijkstra, connected components, Tarjan SCC, Kahn topological sort and cycle detection — classic graph algorithms, no numpy.

larzscript pkg install graph
View on GitHub →Learn the stack

What you get

Try it

import "graph" as graph
let g = graph.new()
graph.add_edge(g, "a", "b", 1)
graph.add_edge(g, "b", "c", 2)
print(graph.bfs(g, "a"))
print(graph.dijkstra(g, "a"))
print(graph.has_cycle(g))
graph.add_edge(g, "c", "a", 3)
print(graph.has_cycle(g))
Output
[a, b, c]
{a: 0, b: 1, c: 3}
false
true

Why it's in the Larz Stack

larzgraph is a real Larzscript package (larzscript pkg install graph) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.