UnionFind algorithm for connected component labelling

Summary
UnionFind algorithm for connected component labelling
Functions
UFNewCreates the structure to use the unionfind algorithm
UFFindFinds the top-most parent of the element a.
UFJoinCreates the structure to use the unionfind algorithm
UFNewFrees the memory used by set

Functions

UFNew

UF *UFNew(int max_sets)

Creates the structure to use the unionfind algorithm

Parameters

max_setsthe maximum number of sets expected

Returns

The disjoint set structure

UFFind

int UFFind(UF *set,
int a)

Finds the top-most parent of the element a.

Parameters

setThe set to examine
aThe element to get the parent

Returns

The top-most parent of a

UFJoin

UF *UFJoin(UF *set,
int a,
int b)

Creates the structure to use the unionfind algorithm

Parameters

max_setsthe maximum number of sets expected

Returns

The disjoint set structure

UFNew

Frees the memory used by set

Parameters

setstructure to be deleted
UF *UFNew(int max_sets)
Creates the structure to use the unionfind algorithm
int UFFind(UF *set,
int a)
Finds the top-most parent of the element a.
UF *UFJoin(UF *set,
int a,
int b)
Creates the structure to use the unionfind algorithm
Close