fn() weaklyConnectedComponentsCompute weakly connected components of a directed graph.
Compute weakly connected components of a directed graph.
| Defined in | <seqan/graph_algorithms.h> |
|---|---|
| Signature |
TSize weaklyConnectedComponents(components, g);
|
Parameters
components
|
A property map. Each vertex is mapped to a component id. If two vertices share the same id they are in the same component. |
|---|---|
g
|
A DirectedGraph to use for the input. |
Return Values
TSize |
The number of weakly connected components (Metafunction: Size of the type of g). |
|---|
Detailed Description
The running time is O(n a(n, n)) where a is the inverse Ackermann function and thus almost linear. The union find data structure is used since the graph implementations do not allow the efficient iteration of in-edges.
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.