25 #ifndef __MLPACK_METHODS_EMST_UNION_FIND_HPP
26 #define __MLPACK_METHODS_EMST_UNION_FIND_HPP
51 for (
size_t i = 0; i <
size; ++i)
67 size_t Find(
const size_t x)
87 void Union(
const size_t x,
const size_t y)
89 const size_t xRoot =
Find(x);
90 const size_t yRoot =
Find(y);
115 #endif // __MLPACK_METHODS_EMST_UNION_FIND_HPP
UnionFind(const size_t size)
Construct the object with the given size.
A Union-Find data structure.
arma::Col< size_t > parent
void Union(const size_t x, const size_t y)
Union the components containing x and y.
size_t Find(const size_t x)
Returns the component containing an element.
~UnionFind()
Destroy the object (nothing to do).