MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / union

Method union

graphs/minimum_spanning_tree_kruskal2.py:44–46  ·  view source on GitHub ↗
(self, data1: T, data2: T)

Source from the content-addressed store, hash-verified

42 node2.rank += 1
43
44 def union(self, data1: T, data2: T) -> None:
45 # merge 2 disjoint sets
46 self.link(self.find_set(data1), self.find_set(data2))
47
48
49class GraphUndirectedWeighted[T]:

Callers 1

kruskalMethod · 0.45

Calls 2

linkMethod · 0.95
find_setMethod · 0.95

Tested by

no test coverage detected