Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::internal::gcm::datastructure::UnionFind Class Reference

Implements the Union Find Datastructure to maintain disjoint sets efficiently. More...

#include <ogdf/geometric/cr_min/datastructure/UnionFind.h>

Public Member Functions

 UnionFind (unsigned int max_element)
 Create a new set representation with not more than max_element elements. More...
 
void all_to_singletons ()
 Assigns every element to a singleton set. More...
 
unsigned int find (unsigned int u)
 Find the representative to element u. More...
 
void merge (unsigned int u, unsigned int v)
 Merge the two sets containing u and v. More...
 
unsigned int operator[] (unsigned int u)
 

Private Attributes

std::vector< int > data
 

Detailed Description

Implements the Union Find Datastructure to maintain disjoint sets efficiently.

Definition at line 45 of file UnionFind.h.

Constructor & Destructor Documentation

◆ UnionFind()

ogdf::internal::gcm::datastructure::UnionFind::UnionFind ( unsigned int  max_element)
inline

Create a new set representation with not more than max_element elements.

Initialy every element is in its own set.

Parameters
max_elementmaximum number of elements

Definition at line 55 of file UnionFind.h.

Member Function Documentation

◆ all_to_singletons()

void ogdf::internal::gcm::datastructure::UnionFind::all_to_singletons ( )
inline

Assigns every element to a singleton set.

Set id is equal to element id.

Definition at line 63 of file UnionFind.h.

◆ find()

unsigned int ogdf::internal::gcm::datastructure::UnionFind::find ( unsigned int  u)
inline

Find the representative to element u.

Parameters
uelement
Returns
representative of set containing u

Definition at line 70 of file UnionFind.h.

◆ merge()

void ogdf::internal::gcm::datastructure::UnionFind::merge ( unsigned int  u,
unsigned int  v 
)
inline

Merge the two sets containing u and v.

Parameters
uelement u
velement v

Definition at line 87 of file UnionFind.h.

◆ operator[]()

unsigned int ogdf::internal::gcm::datastructure::UnionFind::operator[] ( unsigned int  u)
inline

Definition at line 80 of file UnionFind.h.

Member Data Documentation

◆ data

std::vector<int> ogdf::internal::gcm::datastructure::UnionFind::data
private

Definition at line 47 of file UnionFind.h.


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