Skip to main content

Module components

Module components 

Source
Expand description

Connected components — undirected (union-find) + strongly-connected (Tarjan, directed). Both return a labelling Vec<usize> (comp[i] = component id, compact 0..count) plus the component count.

Structs§

Components
A component labelling: of[i] is node i’s component (compact 0..count).

Functions§

connected
Weakly / undirected connected components via union-find. Two nodes share a component iff a path connects them ignoring edge direction.
strongly_connected
Strongly connected components (Tarjan, directed). Two nodes share an SCC iff each is reachable from the other following edge direction. Iterative (no recursion blowout on deep graphs). Component ids are compact 0..count.