Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::DisjointSets< T > Class Template Reference

#include <disjointsets.h>

Public Member Functions

 DisjointSets (T size)
 
bool join (T r, T s)
 
find (T x)
 
cardinality (T x)
 
std::size_t size ()
 

Detailed Description

template<typename T = int>
class inviwo::DisjointSets< T >

Disjoint sets data structure with path compression and weighted unions.

See also
https://en.m.wikipedia.org/wiki/Disjoint-set_data_structure

Constructor & Destructor Documentation

◆ DisjointSets()

template<typename T >
inviwo::DisjointSets< T >::DisjointSets ( T size)
inlineexplicit

Construct size disjoint sets with 1 member in each set.

Member Function Documentation

◆ cardinality()

template<typename T >
T inviwo::DisjointSets< T >::cardinality ( T x)
inline

Returns cardinality of the set for element x Requires x to be positive and less than size.

◆ find()

template<typename T >
T inviwo::DisjointSets< T >::find ( T x)
inline

Returns name of the set for element x i.e. return root of tree for element x Requires x to be positive and less than size.

◆ join()

template<typename T >
bool inviwo::DisjointSets< T >::join ( T r,
T s )
inline

Join the sets of element r and s. Requires r and s to be positive and less than size. Return true it the sets were joined or false if r and s already were in the same set.

◆ size()

template<typename T >
std::size_t inviwo::DisjointSets< T >::size ( )
inline

Returns the total number of elements in all sets


The documentation for this class was generated from the following file: