disjoint_set_union Subroutine
- Seyed Ali Ghasemi
- BSD 3-Clause
- 14 statements
public pure subroutine disjoint_set_union(parent, a, b)
Merge two disjoint-set components using path halving.
Roots are linked deterministically by their integer identifier. This is the union-find structure analyzed by Tarjan (1975), without a separate rank array.
Arguments
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout), | contiguous | :: | parent(:) |
Parent forest initialized with |
|
| integer, | intent(in) | :: | a |
One-based member of the first component. |
||
| integer, | intent(in) | :: | b |
One-based member of the second component. |