Expand description
Graph algorithms operating against the GraphQuery<V> interface.
Ported from Pattern.Graph.Algorithms in the Haskell reference implementation.
All functions are representation-independent: they operate on GraphQuery<V>
closures only. The same code works against PatternGraph, in-memory closures,
or any future backing store.
§Traversal weight semantics
Pass a TraversalWeight<V> to control which edges are traversable and at
what cost. Use the canonical functions undirected, directed, or
directed_reverse, or supply a custom Rc<dyn Fn(...)>.
An edge with INFINITY cost in a given direction is impassable in that direction.
Functions§
- all_
paths - Enumerate all simple paths from
fromtoto(no repeated nodes). - betweenness_
centrality - Betweenness centrality using the Brandes BFS algorithm (unnormalized).
- bfs
- Breadth-first traversal from
start. - connected_
components - Partition the graph into connected components.
- degree_
centrality - Degree centrality for all nodes.
- dfs
- Depth-first traversal from
start. - has_
cycle - Returns
trueif the graph contains a directed cycle. - has_
path - Returns
trueif a path exists fromfromtoto. - is_
connected - Returns
trueif the entire graph is connected underweight. - is_
neighbor - Returns
trueifbis directly reachable fromain one hop underweight. - minimum_
spanning_ tree - Minimum spanning tree using Kruskal’s algorithm with path-compression union-find.
- query_
annotations_ of - Returns all containers of
elementthat are classified as annotations. - query_
co_ members - Returns all elements that share
containerwithelement, excludingelementitself. - query_
walks_ containing - Returns all containers of
elementthat are classified as walks. - shortest_
path - Find the minimum-cost path from
fromtotousing Dijkstra’s algorithm. - topological_
sort - Topological sort using iterative DFS post-order with cycle detection.