21 for(
int i = 0; i < N;i++)
52 while(x < N && x !=
id[x])
61 while(x <N &&x !=
id[x])
88 if (sz[i] < sz[j]) {
id[i] = j; sz[j] += sz[i]; }
89 else {
id[j] = i; sz[i] += sz[j]; }
int find(int x)
return label number of element x
Definition: union_find.h:70
~union_find()
destructor
Definition: union_find.h:29
Definition: union_find.h:9
int num_of_components()
number of sets (initially number of all elements)
Definition: union_find.h:36
void unite(int p, int q)
unite the set containing p with the set containing q (if p and q are in the same set,...
Definition: union_find.h:83
union_find(int N)
N number of all elements.
Definition: union_find.h:16
bool find(int p, int q)
check wether p and q are in the same set
Definition: union_find.h:94
the cgv namespace
Definition: vr_calib.cxx:9