#include <UnionFind.h>
Public Member Functions | |
std::size_t | find (std::size_t x) |
void | grow (const std::size_t n=1) |
Enlarges the data structure by n elements. | |
void | merge (std::size_t x, std::size_t y) |
std::size_t | size () const |
UnionFind (const std::size_t n) | |
Private Attributes | |
std::vector< std::size_t > | m_parent |
std::vector< std::size_t > | m_rank |
A very simple union-find data structure for clustering on the set of indices 0..(n-1).
Definition at line 34 of file UnionFind.h.
icl_core::UnionFind::UnionFind | ( | const std::size_t | n | ) | [inline] |
Definition at line 37 of file UnionFind.h.
std::size_t icl_core::UnionFind::find | ( | std::size_t | x | ) | [inline] |
Definition at line 88 of file UnionFind.h.
void icl_core::UnionFind::grow | ( | const std::size_t | n = 1 | ) | [inline] |
Enlarges the data structure by n elements.
Definition at line 47 of file UnionFind.h.
void icl_core::UnionFind::merge | ( | std::size_t | x, |
std::size_t | y | ||
) | [inline] |
Not calling this "union" because of the obvious clash with the C++ keyword.
Definition at line 61 of file UnionFind.h.
std::size_t icl_core::UnionFind::size | ( | ) | const [inline] |
Definition at line 101 of file UnionFind.h.
std::vector<std::size_t> icl_core::UnionFind::m_parent [private] |
Definition at line 104 of file UnionFind.h.
std::vector<std::size_t> icl_core::UnionFind::m_rank [private] |
Definition at line 105 of file UnionFind.h.