MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / find

Method find

graphs/minimum_spanning_tree_boruvka.py:121–126  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

119 return item
120
121 def find(self, item):
122 if item not in self.parent:
123 return self.make_set(item)
124 if item != self.parent[item]:
125 self.parent[item] = self.find(self.parent[item])
126 return self.parent[item]
127
128 def union(self, item1, item2):
129 root1 = self.find(item1)

Callers 3

make_setMethod · 0.95
unionMethod · 0.95
boruvka_mstMethod · 0.95

Calls 1

make_setMethod · 0.95

Tested by

no test coverage detected