Blender V4.3
blender::DisjointSet< T > Class Template Reference

#include <BLI_disjoint_set.hh>

Public Member Functions

 DisjointSet (const int64_t size)
 
void join (const T x, const T y)
 
bool in_same_set (const T x, const T y)
 
T find_root (const T x)
 

Detailed Description

template<typename T = int64_t>
class blender::DisjointSet< T >

Definition at line 18 of file BLI_disjoint_set.hh.

Constructor & Destructor Documentation

◆ DisjointSet()

template<typename T = int64_t>
blender::DisjointSet< T >::DisjointSet ( const int64_t size)
inline

Create a new disjoint set with the given size. Initially, every element is in a separate set.

Definition at line 27 of file BLI_disjoint_set.hh.

References BLI_assert, and T.

Member Function Documentation

◆ find_root()

template<typename T = int64_t>
T blender::DisjointSet< T >::find_root ( const T x)
inline

Find the element that represents the set containing x currently.

Definition at line 73 of file BLI_disjoint_set.hh.

References x.

Referenced by blender::DisjointSet< T >::in_same_set(), blender::DisjointSet< T >::join(), and blender::tests::TEST().

◆ in_same_set()

template<typename T = int64_t>
bool blender::DisjointSet< T >::in_same_set ( const T x,
const T y )
inline

Return true when x and y are in the same set.

Definition at line 63 of file BLI_disjoint_set.hh.

References blender::DisjointSet< T >::find_root().

Referenced by blender::tests::TEST().

◆ join()

template<typename T = int64_t>
void blender::DisjointSet< T >::join ( const T x,
const T y )
inline

Join the sets containing elements x and y. Nothing happens when they have been in the same set before.

Definition at line 39 of file BLI_disjoint_set.hh.

References blender::DisjointSet< T >::find_root().

Referenced by blender::tests::TEST().


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