Skip to main content

connected_components

Function connected_components 

Source
pub fn connected_components(g: &CsrGraph) -> Vec<u32>
Expand description

Connected components via union-find (union-by-rank + path compression).

Returns one component-root index per node; nodes sharing a root are in the same component. O((V + E) · α(V)) — effectively linear. The root is a node index (not a sequential component id); callers can relabel if needed.