Class PureLinkGraphConnectedComponents.UnionFind
java.lang.Object
org.bigraphs.framework.core.analysis.PureLinkGraphConnectedComponents.UnionFind
- Enclosing class:
- PureLinkGraphConnectedComponents
Generic subclass that solves the connectedness problem of a graph.
Vertices are integers.
This implementation is suited for hypergraphs (see
union(Set)
).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
countRoots
(Map<Integer, Integer> parentMap) int
find
(int x) int
getCount()
getRank()
getRootsOfPartitions
(Map<Integer, Integer> parentMap) void
The union method finds the representative (root) of each vertex in the hyperedge, and then merges the sets containing those representatives using the standard Union-Find operations.
-
Constructor Details
-
UnionFind
public UnionFind(int numVertices)
-
-
Method Details
-
find
public int find(int x) -
union
The union method finds the representative (root) of each vertex in the hyperedge, and then merges the sets containing those representatives using the standard Union-Find operations.It takes a Set
of vertices instead of just two vertices. This allows to handle hyperedges that connect multiple vertices. - Parameters:
vertices
- the vertices connected to a hyperedge
-
getCount
public int getCount() -
getChildParentMap
-
getRank
-
getRootsOfPartitions
-
countRoots
-