Class DisjointSets
- java.lang.Object
-
- org.locationtech.jts.operation.union.DisjointSets
-
public class DisjointSets extends java.lang.Object
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 Classes Modifier and Type Class Description class
DisjointSets.Subsets
Provides accessors for items in disjoint subsets.
-
Constructor Summary
Constructors Constructor Description DisjointSets(int size)
Creates a new structure containing a given number of items.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isSameSubset(int i, int j)
void
merge(int i, int j)
DisjointSets.Subsets
subsets()
-
-
-
Method Detail
-
isSameSubset
public boolean isSameSubset(int i, int j)
-
merge
public void merge(int i, int j)
-
subsets
public DisjointSets.Subsets subsets()
-
-