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.
|
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 2024-08-06 UTC.
[null,null,["Last updated 2024-08-06 UTC."],[],["The `DenseConnectedComponentsFinder` class in C++ identifies connected components within a graph of dense integers. Key actions include `AddEdge` to define connections between nodes and `Connected` to check if two nodes are connected. `FindRoot` retrieves the root node of a given node's set, while `GetComponentRoots` returns a list of all root nodes. Methods like `GetNumberOfComponents`, `GetNumberOfNodes`, and `GetSize` provide information about the graph. `SetNumberOfNodes` is used to define the graph's size. `GetComponentIds` returns the connected components.\n"]]