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

Method set_component

graphs/boruvka.py:61–66  ·  view source on GitHub ↗

Finds the component index of a given node

(self, u_node: int)

Source from the content-addressed store, hash-verified

59 return self.find_component(self.m_component[u_node])
60
61 def set_component(self, u_node: int) -> None:
62 """Finds the component index of a given node"""
63
64 if self.m_component[u_node] != u_node:
65 for k in self.m_component:
66 self.m_component[k] = self.find_component(k)
67
68 def union(self, component_size: list[int], u_node: int, v_node: int) -> None:
69 """Union finds the roots of components for two nodes, compares the components

Callers 1

unionMethod · 0.95

Calls 1

find_componentMethod · 0.95

Tested by

no test coverage detected