7typedef struct UnionFind_ {
Disjoint set forest on {0, .., n-1}.
int * unionfind_findall(UnionFind *uf)
Returns a designated representative of each subset in an array (array.h).
int unionfind_find(UnionFind *uf, int x)
Finds the designated representative of the subset containing x.
void unionfind_init(UnionFind *uf, int n)
Creates a UnionFind structure on {0, ..., n}.
void unionfind_union(UnionFind *uf, int x, int y)
Declares x and y to be in the same subset.
void unionfind_free(UnionFind *uf)
Frees resources associated with uf.