bayesnet.internal.jayes.util
Class UnionFind
- java.lang.Object
-
- bayesnet.internal.jayes.util.UnionFind
-
public class UnionFind extends java.lang.ObjectDisjoint Set Datastructure, uses Union by Rank and Path Compression heuristics.- See Also:
- "Efficiency of a Good But Not Linear Set Union Algorithm" (Tarjan, 1975)
-
-
Constructor Summary
Constructors Constructor and Description UnionFind()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static UnionFind[]createArray(int size)UnionFindfind()voidmerge(UnionFind other)Unites the sets.intrank()
-
-
-
Method Detail
-
find
public UnionFind find()
- Returns:
- the set that contains this element
-
merge
public void merge(UnionFind other)
Unites the sets. In equal rank case, the other set is chosen as the new root.
-
rank
public int rank()
- Returns:
- upper bound for the height of the tree rooted at this element
-
createArray
public static UnionFind[] createArray(int size)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG