Interface DisjointSetStruct
-
- All Known Implementing Classes:
HugeAtomicDisjointSetStruct
,IncrementalDisjointSetStruct
,NonInrementalDisjointSetStruct
,SequentialDisjointSetStruct
public interface DisjointSetStruct
Disjoint-set-struct is a data structure that keeps track of a set of elements partitioned into a number of disjoint (non-overlapping) subsets.- See Also:
- Wiki
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default LongNodeProperties
asNodeProperties()
Wraps the DisjointSetStruct in an LongNodeProperties interfaceboolean
sameSet(long p, long q)
Deprecated.use only in testslong
setIdOf(long nodeId)
Find set Id of element p.long
size()
Number of elements stored in the data structure.void
union(long p, long q)
Joins the set of p (Sp) with set of q (Sq).
-
-
-
Method Detail
-
union
void union(long p, long q)
Joins the set of p (Sp) with set of q (Sq).- Parameters:
p
- an item of Spq
- an item of Sq
-
setIdOf
long setIdOf(long nodeId)
Find set Id of element p.- Parameters:
nodeId
- the element in the set we are looking for- Returns:
- an id of the set it belongs to
-
sameSet
@Deprecated boolean sameSet(long p, long q)
Deprecated.use only in testsCheck if p and q belong to the same set.- Parameters:
p
- a set itemq
- a set item- Returns:
- true if both items belong to the same set, false otherwise
-
size
long size()
Number of elements stored in the data structure.- Returns:
- element count
-
asNodeProperties
default LongNodeProperties asNodeProperties()
Wraps the DisjointSetStruct in an LongNodeProperties interface- Returns:
- wrapped DisjointSetStruct
-
-