Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
49
class
GraphUndirectedWeighted[T]:
Callers
1
kruskal
Method · 0.45
Calls
2
link
Method · 0.95
find_set
Method · 0.95
Tested by
no test coverage detected