@Reference(authors="R. Sedgewick", title="Algorithms in C, Parts 1-4", booktitle="", bibkey="DBLP:books/daglib/0004943") public class WeightedQuickUnionRangeDBIDs extends java.lang.Object implements UnionFind
DBIDRange only, with optimizations.
 
 To instantiate, use UnionFindUtil.make(de.lmu.ifi.dbs.elki.database.ids.StaticDBIDs). This version is optimized for
 DBIDRanges.
 
This is the weighted quick union approach, weighted by count and using path-halving for optimization.
Reference:
 R. Sedgewick
 1.3 Union-Find Algorithms
 Algorithms in C, Parts 1-4
| Modifier and Type | Field and Description | 
|---|---|
private DBIDRange | 
ids
Object ID range. 
 | 
private int[] | 
parent
Parent element 
 | 
private int[] | 
weight
Weight, for optimization. 
 | 
| Constructor and Description | 
|---|
WeightedQuickUnionRangeDBIDs(DBIDRange ids)
Constructor (package private, use  
UnionFindUtil.make(de.lmu.ifi.dbs.elki.database.ids.StaticDBIDs)). | 
| Modifier and Type | Method and Description | 
|---|---|
int | 
find(DBIDRef element)
Find the component ID of an element. 
 | 
DBIDs | 
getRoots()
Collect all component root elements. 
 | 
boolean | 
isConnected(DBIDRef first,
           DBIDRef second)
Test if two components are connected. 
 | 
int | 
union(DBIDRef first,
     DBIDRef second)
Join the components of elements p and q. 
 | 
private DBIDRange ids
private int[] parent
private int[] weight
WeightedQuickUnionRangeDBIDs(DBIDRange ids)
UnionFindUtil.make(de.lmu.ifi.dbs.elki.database.ids.StaticDBIDs)).ids - Range to usepublic int find(DBIDRef element)
UnionFindpublic int union(DBIDRef first, DBIDRef second)
UnionFindpublic boolean isConnected(DBIDRef first, DBIDRef second)
UnionFindisConnected in interface UnionFindfirst - First elementsecond - Second elementtrue if they are in the same component.Copyright © 2019 ELKI Development Team. License information.