Send feedback
Stay organized with collections
Save and categorize content based on your preferences.
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.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-09-14 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?