libSmalldb  v0.7
Public Member Functions | Public Attributes | List of all members
UnionFind Class Reference

Description

Union-Find on scalar values (IDs or indexes)

Public Member Functions

 __construct ()
 Constructor. More...
 
 add ($x)
 Create set $x, the $x may or may not exist before. More...
 
 addUnique ($x)
 Create set $x, the $x must not exist before. More...
 
 union ($a, $b)
 Union sets $a and $b. More...
 
 find ($r)
 Get representative of $x. More...
 
 findAll ()
 Get map of all items -> representative. More...
 
 findDistinct ()
 Get a representative for each component. More...
 
 dumpDot ()
 Debug: Dump the UF tree to Dot for Graphviz. More...
 

Public Attributes

 $parents
 

Constructor & Destructor Documentation

__construct ( )

Constructor.

Member Function Documentation

add (   $x)

Create set $x, the $x may or may not exist before.

addUnique (   $x)

Create set $x, the $x must not exist before.

union (   $a,
  $b 
)

Union sets $a and $b.

find (   $r)

Get representative of $x.

findAll ( )

Get map of all items -> representative.

findDistinct ( )

Get a representative for each component.

dumpDot ( )

Debug: Dump the UF tree to Dot for Graphviz.