Blender  V2.93
Public Member Functions | List of all members
blender::DisjointSet Class Reference

#include <BLI_disjoint_set.hh>

Public Member Functions

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

Detailed Description

Definition at line 29 of file BLI_disjoint_set.hh.

Constructor & Destructor Documentation

◆ DisjointSet()

blender::DisjointSet::DisjointSet ( int64_t  size)
inline

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

Definition at line 38 of file BLI_disjoint_set.hh.

References BLI_assert, and size().

Member Function Documentation

◆ find_root()

int64_t blender::DisjointSet::find_root ( int64_t  x)
inline

Find the element that represents the set containing x currently.

Definition at line 84 of file BLI_disjoint_set.hh.

References x.

Referenced by in_same_set(), join(), and blender::tests::TEST().

◆ in_same_set()

bool blender::DisjointSet::in_same_set ( int64_t  x,
int64_t  y 
)
inline

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

Definition at line 74 of file BLI_disjoint_set.hh.

References find_root().

Referenced by blender::fn::mf_network_optimization::nodes_output_same_values(), and blender::tests::TEST().

◆ join()

void blender::DisjointSet::join ( int64_t  x,
int64_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 50 of file BLI_disjoint_set.hh.

References find_root(), and swap().

Referenced by blender::fn::mf_network_optimization::nodes_output_same_values(), and blender::tests::TEST().


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