naev 0.10.4
Functions
union_find.c File Reference

Implements ye olde disjoint-set-forest data structure. More...

#include "union_find.h"
#include "array.h"

Go to the source code of this file.

Functions

void unionfind_init (UnionFind *uf, int n)
 Creates a UnionFind structure on {0, ..., n}. More...
 
void unionfind_free (UnionFind *uf)
 Frees resources associated with uf. More...
 
void unionfind_union (UnionFind *uf, int x, int y)
 Declares x and y to be in the same subset. More...
 
int unionfind_find (UnionFind *uf, int x)
 Finds the designated representative of the subset containing x. More...
 
int * unionfind_findall (UnionFind *uf)
 Returns a designated representative of each subset in an array (array.h). More...
 

Detailed Description

Implements ye olde disjoint-set-forest data structure.

Definition in file union_find.c.

Function Documentation

◆ unionfind_find()

int unionfind_find ( UnionFind uf,
int  x 
)

Finds the designated representative of the subset containing x.

Definition at line 48 of file union_find.c.

◆ unionfind_findall()

int * unionfind_findall ( UnionFind uf)

Returns a designated representative of each subset in an array (array.h).

Definition at line 56 of file union_find.c.

◆ unionfind_free()

void unionfind_free ( UnionFind uf)

Frees resources associated with uf.

Definition at line 25 of file union_find.c.

◆ unionfind_init()

void unionfind_init ( UnionFind uf,
int  n 
)

Creates a UnionFind structure on {0, ..., n}.

Definition at line 14 of file union_find.c.

◆ unionfind_union()

void unionfind_union ( UnionFind uf,
int  x,
int  y 
)

Declares x and y to be in the same subset.

Definition at line 34 of file union_find.c.