MLPACK  1.0.4
Public Member Functions | Private Attributes
mlpack::emst::UnionFind Class Reference

A Union-Find data structure. More...

List of all members.

Public Member Functions

 UnionFind (const size_t size)
 Construct the object with the given size.
 ~UnionFind ()
 Destroy the object (nothing to do).
size_t Find (const size_t x)
 Returns the component containing an element.
void Union (const size_t x, const size_t y)
 Union the components containing x and y.

Private Attributes

arma::Col< size_t > parent
arma::ivec rank
size_t size

Detailed Description

A Union-Find data structure.

See Cormen, Rivest, & Stein for details. The structure tracks the components of a graph. Each point in the graph is initially in its own component. Calling Union(x, y) unites the components indexed by x and y. Find(x) returns the index of the component containing point x.

Definition at line 40 of file union_find.hpp.


Constructor & Destructor Documentation

mlpack::emst::UnionFind::UnionFind ( const size_t  size) [inline]

Construct the object with the given size.

Definition at line 49 of file union_find.hpp.

References parent, rank, and size.

Destroy the object (nothing to do).

Definition at line 59 of file union_find.hpp.


Member Function Documentation

size_t mlpack::emst::UnionFind::Find ( const size_t  x) [inline]

Returns the component containing an element.

Parameters:
xthe component to be found
Returns:
The index of the component containing x

Definition at line 67 of file union_find.hpp.

References parent.

Referenced by Union().

void mlpack::emst::UnionFind::Union ( const size_t  x,
const size_t  y 
) [inline]

Union the components containing x and y.

Parameters:
xone component
ythe other component

Definition at line 87 of file union_find.hpp.

References Find(), parent, and rank.


Member Data Documentation

arma::Col<size_t> mlpack::emst::UnionFind::parent [private]

Definition at line 44 of file union_find.hpp.

Referenced by Find(), Union(), and UnionFind().

arma::ivec mlpack::emst::UnionFind::rank [private]

Definition at line 45 of file union_find.hpp.

Referenced by Union(), and UnionFind().

Definition at line 43 of file union_find.hpp.

Referenced by UnionFind().


The documentation for this class was generated from the following file: