C++ Reference: class ConnectedComponentsFinder

This documentation is automatically generated.

Method
AddEdge

Return type: void

Arguments: T node1, T node2

Adds an edge in the graph. Also adds both endpoint nodes as necessary. It is not an error to add the same edge twice. Self-edges are OK too.

AddNode

Return type: void

Arguments: T node

Adds a node in the graph. It is OK to add the same node more than once; additions after the first have no effect.

Connected

Return type: bool

Arguments: T node1, T node2

Returns true iff both nodes are in the same connected component. Returns false if either node has not been already added with AddNode.

ConnectedComponentsFinder

Constructs a connected components finder.

ConnectedComponentsFinder

Arguments: const ConnectedComponentsFinder&) = delete; ConnectedComponentsFinder& operator=(const ConnectedComponentsFinder&) = delete; // Adds a node in the graph. It is OK to add the same node more than // once; additions after the first have no effect. void AddNode(T node

FindConnectedComponents

Return type: void

Arguments: std::vector<typename internal::ConnectedComponentsTypeHelper< T, CompareOrHashT>::Set>* components

GetNumberOfComponents

Return type: int

Returns the current number of connected components. This number can change as the new nodes or edges are added.

GetNumberOfNodes

Return type: int

Returns the current number of added distinct nodes. This includes nodes added explicitly via the calls to AddNode() method and implicitly via the calls to AddEdge() method. Nodes that were added several times only count once.

GetSize

Return type: int

Arguments: T node

Finds the connected component containing a node, and returns the total number of nodes in that component. Returns zero iff the node has not been already added with AddNode.