Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/TheAlgorithms/Python
/ find_parent
Function
find_parent
graphs/minimum_spanning_tree_kruskal.py:19–22 ·
view source on GitHub ↗
(i)
Source
from the content-addressed store, hash-verified
17
parent = list(range(num_nodes))
18
19
def
find_parent(i):
20
if
i != parent[i]:
21
parent[i] = find_parent(parent[i])
22
return
parent[i]
23
24
minimum_spanning_tree_cost = 0
25
minimum_spanning_tree = []
Callers
1
kruskal
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected