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