C++ Reference: connected_components
Note: This documentation is automatically generated.
Finds the connected components in an undirected graph: https://en.wikipedia.org/wiki/Connected_component_(graph_theory)If you have a fixed graph where the node are dense integers, use GetConnectedComponents(): it's very fast and uses little memory.
If you have a more dynamic scenario where you want to incrementally add nodes or edges and query the connectivity between them, use the [Dense]ConnectedComponentsFinder class, which uses the union-find algorithm aka disjoint sets: https://en.wikipedia.org/wiki/Disjoint-set_data_structure.
Classes |
|
---|---|
ConnectedComponentsFinder | |
DenseConnectedComponentsFinder |