src/disjoint_set.c File Reference

Disjoint-set implementation. More...

#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
#include "disjoint_set.h"
#include "debug.h"
Include dependency graph for disjoint_set.c:

Go to the source code of this file.

Functions

static void link_sets (disjoint_set_t *ds, size_t set1, size_t set2)
 Links two sets.
static size_t find_set (disjoint_set_t *ds, size_t id)
 Finds the set containing an element.
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 elem1, size_t elem2)
 Unites the sets that contain two elements.
int disjoint_set_find (disjoint_set_t *ds, size_t *set, size_t elem)
 Finds the set containing an element.

Detailed Description

Disjoint-set implementation.

Definition in file disjoint_set.c.


Function Documentation

static size_t find_set ( disjoint_set_t ds,
size_t  id 
) [static]

Finds the set containing an element.

Parameters:
ds the disjoint_set_t to search in
id the id of the element to find the set of
Returns:
the id (root) of the found set

Definition at line 71 of file disjoint_set.c.

Referenced by disjoint_set_find().

Here is the caller graph for this function:

static void link_sets ( disjoint_set_t ds,
size_t  set1,
size_t  set2 
) [static]

Links two sets.

Parameters:
ds the disjoint_set_t the sets belong to
set1 the id (root) of set1
set2 the id (root) of set2

Definition at line 49 of file disjoint_set.c.

Referenced by disjoint_set_union().

Here is the caller graph for this function:


Generated on Sun Nov 15 15:27:46 2009 for libbls by  doxygen 1.6.1