C++ Reference: class DenseConnectedComponentsFinder

Note: This documentation is automatically generated.

A connected components finder that only works on dense ints.
Method
AddEdge

Return type: bool

Arguments: int node1, int node2

The main API is the same as ConnectedComponentsFinder (below): see the homonymous functions there.

Connected

Return type: bool

Arguments: int node1, int node2

DenseConnectedComponentsFinder

DenseConnectedComponentsFinder

Arguments: const DenseConnectedComponentsFinder&) = default; DenseConnectedComponentsFinder& operator=( const DenseConnectedComponentsFinder&

We support copy and move construction.

DenseConnectedComponentsFinder

Arguments: DenseConnectedComponentsFinder&&

FindRoot

Return type: int

Arguments: int node

Returns the root of the set for the given node. node must be in [0;GetNumberOfNodes()-1]. Non-const because it does path compression internally.

GetComponentIds

Return type: std::vector<int>

Returns the same as GetConnectedComponents().

GetComponentRoots

Return type: const std::vector<int>&

Gets the current set of root nodes in sorted order. Runs in amortized O(#components) time.

GetNumberOfComponents

Return type: int

GetNumberOfNodes

Return type: int

GetSize

Return type: int

Arguments: int node

SetNumberOfNodes

Return type: void

Arguments: int num_nodes

Sets the number of nodes in the graph. The graph can only grow: this dies if "num_nodes" is lower or equal to any of the values ever given to AddEdge(), or lower than a previous value given to SetNumberOfNodes(). You need this if there are nodes that don't have any edges.