WeightedUnion

com.phasmidsoftware.gryphon.adjunct.WeightedUnion
object WeightedUnion

Shared weighted-union logic for all ParentSize-based disjoint-set implementations.

Extracted here to avoid duplication between ConnectivityLazy and ConnectivityOptimized, both of which use identical merge strategies. A single point of change ensures the two implementations cannot silently diverge.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[V](map: Map[V, ParentSize[V]], v1: V, v2: V, label: String): Map[V, ParentSize[V]]

Merges the components rooted at v1 and v2 in map by attaching the smaller tree under the larger, updating the root's size accordingly. Both v1 and v2 must be distinct roots present in map.

Merges the components rooted at v1 and v2 in map by attaching the smaller tree under the larger, updating the root's size accordingly. Both v1 and v2 must be distinct roots present in map.

Value parameters

label

a class name used in exception messages.

Attributes