Go to the source code of this file.
◆ DisjointSet
◆ set_disjoint_create()
Creates a new disjoint-set data structure with n elements.
- Parameters
-
| [in] | n | The number of elements. |
- Returns
- A pointer to the new disjoint-set.
◆ set_disjoint_find()
Finds the representative of the set containing element i.
- Parameters
-
| [in] | ds | The disjoint-set. |
| [in] | i | The element to find. |
- Returns
- The representative of the set containing i.
◆ set_disjoint_free()
Free a disjoint-set data structure.
- Parameters
-
| [in,out] | ds | A pointer to a pointer to the disjoint-set. |
◆ set_disjoint_union()
| void set_disjoint_union |
( |
DisjointSet * | ds, |
|
|
int | i, |
|
|
int | j ) |
Merges the sets containing elements i and j.
- Parameters
-
| [in,out] | ds | The disjoint-set. |
| [in] | i | The first element. |
| [in] | j | The second element. |