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..nstored as adjacency lists. Undirected graphs store each edge in both lists;Graph::edgesreports it once. - Union
Find - A disjoint-set forest with union by rank and path halving (near-constant amortised time).