A disjoint-set implementation using a union-find algorithm. More...
Typedefs | |
typedef struct disjoint_set | disjoint_set_t |
Opaque type for a disjoint-set. | |
Functions | |
int | disjoint_set_new (disjoint_set_t **ds, size_t size) |
Creates a new disjoint-set. | |
int | disjoint_set_free (disjoint_set_t *ds) |
Frees a disjoint-set. | |
int | disjoint_set_union (disjoint_set_t *ds, size_t id1, size_t id2) |
Unites the sets that contain two elements. | |
int | disjoint_set_find (disjoint_set_t *ds, size_t *set_id, size_t id) |
Finds the set containing an element. |
A disjoint-set implementation using a union-find algorithm.
int disjoint_set_find | ( | disjoint_set_t * | ds, | |
size_t * | set, | |||
size_t | elem | |||
) |
Finds the set containing an element.
ds | the disjoint_set_t to search in | |
[out] | set | the found set |
elem | the element to find the set of |
Definition at line 181 of file disjoint_set.c.
References find_set().
Referenced by disjoint_set_union(), and overlap_graph_remove_cycles().
int disjoint_set_free | ( | disjoint_set_t * | ds | ) |
Frees a disjoint-set.
ds | the disjoint_set_t to free |
Definition at line 134 of file disjoint_set.c.
Referenced by overlap_graph_remove_cycles().
int disjoint_set_new | ( | disjoint_set_t ** | ds, | |
size_t | size | |||
) |
Creates a new disjoint-set.
The disjoint-set contains integer elements from 0 to size - 1, initially each in its own set.
[out] | ds | the created disjoint_set_t |
size | the size of the disjoint-set |
Definition at line 94 of file disjoint_set.c.
Referenced by overlap_graph_remove_cycles().
int disjoint_set_union | ( | disjoint_set_t * | ds, | |
size_t | elem1, | |||
size_t | elem2 | |||
) |
Unites the sets that contain two elements.
ds | the disjoint_set_t that contains the elements | |
elem1 | the first element | |
elem2 | the second element |
Definition at line 156 of file disjoint_set.c.
References disjoint_set_find(), and link_sets().
Referenced by overlap_graph_remove_cycles().