Class DisjointSets
java.lang.Object
org.locationtech.jts.operation.union.DisjointSets
A data structure that represents a partition of a set
into disjoint subsets, and allows merging subsets.
Set items are represented by integer indices.
Initially each item is in its own subset.
Client code can merge subsets of items as required for the
algorithm being performed (e.g. set partitioning or clustering).
The current partitioning can be computed at any time,
and subset items accessed by their indices.
See the Wikipedia article on
disjointiset data structures.
- Author:
- mdavis
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassProvides accessors for items in disjoint subsets. -
Constructor Summary
ConstructorsConstructorDescriptionDisjointSets(int size) Creates a new structure containing a given number of items. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisSameSubset(int i, int j) voidmerge(int i, int j) subsets()
-
Constructor Details
-
DisjointSets
public DisjointSets(int size) Creates a new structure containing a given number of items.- Parameters:
size- the number of items contained in the set
-
-
Method Details
-
isSameSubset
public boolean isSameSubset(int i, int j) -
merge
public void merge(int i, int j) -
subsets
-