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

Method find_component

graphs/boruvka.py:54–59  ·  view source on GitHub ↗

Propagates a new component throughout a given component.

(self, u_node: int)

Source from the content-addressed store, hash-verified

52 self.m_edges.append([u_node, v_node, weight])
53
54 def find_component(self, u_node: int) -> int:
55 """Propagates a new component throughout a given component."""
56
57 if self.m_component[u_node] == u_node:
58 return u_node
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"""

Callers 2

set_componentMethod · 0.95
unionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected