Skip to main content

Module graph

Module graph 

Source
Expand description

Graph representation: adjacency lists with conversions to edge lists and matrices, traversal, connected components and a disjoint-set (union-find) structure.

See the book entry Graphs, traversal and orderings.

Structs§

Edge
A weighted edge from → to (both directions for undirected graphs).
Graph
A weighted graph on vertices 0..n stored as adjacency lists. Undirected graphs store each edge in both lists; Graph::edges reports it once.
UnionFind
A disjoint-set forest with union by rank and path halving (near-constant amortised time).