32 #include <boost/shared_ptr.hpp>
100 size_t find(
size_t x );
108 boost::shared_ptr< std::set< size_t > >
getMaxSet();
119 void merge(
size_t i,
size_t j );
126 #endif // WUNIONFIND_H
Implements a very simple union-find datastructure aka disjoint_sets.
void merge(size_t i, size_t j)
Merges two components (iow: makes a union) where the given elements are members of.
std::vector< size_t > m_component
Stores for each index its ID.
size_t find(size_t x)
Find the canonical element of the given element and do path compression.
boost::shared_ptr< std::set< size_t > > getMaxSet()
Computes the set with maximum number of elements.
Unit tests the WUnionFind datastructure.
WUnionFind(size_t size)
Creates a new union find datastructure with size elements where each element is initialized as a sing...