19 #ifndef __TPIE_DISJOINT_SETS__
20 #define __TPIE_DISJOINT_SETS__
42 template <
typename value_t=
size_type>
78 inline void make_set(value_t element) {m_elements[element] = element; ++m_size;}
87 inline bool is_set(value_t element) {
return m_elements[element] != m_unused;}
96 inline value_t
link(value_t a, value_t b) {
115 value_t x = m_elements[m_elements[t]];
116 if (x == t)
return t;
158 #endif //__TPIE_DISJOINT_SETS__
value_t link(value_t a, value_t b)
Union two sets given by their representatives.
value_t find_set(value_t t)
Find the representative of the set contaning a given element.
value_t union_set(value_t a, value_t b)
Union the set containing a with the set containing b.
Base class of data structures with linear memory usage.
bool is_set(value_t element)
Check if a given element is a member of any set.
static double memory_coefficient()
Return the memory coefficient of the structure.
Generic internal array with known memory requirements.
size_type count_sets()
Return the number of sets.
disjoint_sets(size_type n, value_t u=default_unused< value_t >::v())
Construct a empty collection of disjoint sets.
Miscellaneous utility functions.
static double memory_overhead()
Return the memory overhead of the structure.
static double memory_coefficient()
Return the memory coefficient of the structure.
Internal memory union find implementation.
static double memory_overhead()
Return the memory overhead of the structure.
void make_set(value_t element)
Make a singleton set.
Default special unused values for standard types.