Skip to main content

wccs_of

Function wccs_of 

Source
pub fn wccs_of(graph: &Graph) -> NodePartition
Expand description

Returns the weakly connected components of graph. These are the components of the graph read as undirected.

Every node is in exactly one component. Each component is a group of the result. The groups are in the order of their smallest nodes: group 0 holds node 0, group 1 the smallest node not in group 0, and so on. Uses union-find, whose cost grows with alpha(node_count). The inverse Ackermann function alpha is below 5 for any graph.

Time: O((node_count + edge_count) x alpha(node_count)). Memory: up to 12 x node_count bytes for the result; while it runs, 9 x node_count bytes more.