A simple Union-Find data structure.
Each position x
in the table is either a link to another element y
of the same set, or the number of elements in the set if x
is the root of its set.
In the first case, y
is just encoded as is, by the contents tab
[x]. In the second case, the size is the negative of the encoded value that is -tab
[x].
To decide if @x is an inner node or the root we just have to compare it against 0
.
- Warning
- This must be allocated only through p99_uf_alloc, and never on the stack.
- See also
- p99_uf_alloc
-
p99_uf_free
-
p99_uf_find
-
p99_uf_findCompress
-
p99_uf_union
-
p99_uf_flaten
-
p99_uf_size
Definition at line 53 of file p99_uf.h.