UnionFind

org.appliedtopology.tda4j.streams.UnionFind
class UnionFind[T](vertices: IterableOnce[T])

Attributes

Experimental
true
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

case class UFSet(label: UnionFind.this.T)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def find(s: UFSet): UFSet

Path-compressing: every node on the way to the root is repointed directly at it, so repeated find calls into the same subtree are O(1) after the first.

Path-compressing: every node on the way to the root is repointed directly at it, so repeated find calls into the same subtree are O(1) after the first.

Attributes

def union(x: UFSet, y: UFSet): UFSet

Union by rank, root-to-root: the shallower tree's root is repointed at the deeper one's, keeping both bounded at O(log n) depth. Does not preserve the original edge (x, y) as a parent link -- pathsFrom/cycleToChain below reconstruct tree paths from lrList._1 directly, not from these pointers.

Union by rank, root-to-root: the shallower tree's root is repointed at the deeper one's, keeping both bounded at O(log n) depth. Does not preserve the original edge (x, y) as a parent link -- pathsFrom/cycleToChain below reconstruct tree paths from lrList._1 directly, not from these pointers.

Attributes

Concrete fields

val sets: Map[UFSet, UFSet]