MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / make_set

Method make_set

graphs/minimum_spanning_tree_kruskal2.py:22–24  ·  view source on GitHub ↗
(self, data: T)

Source from the content-addressed store, hash-verified

20 self.map: dict[T, DisjointSetTreeNode[T]] = {}
21
22 def make_set(self, data: T) -> None:
23 # create a new set with x as its member
24 self.map[data] = DisjointSetTreeNode(data)
25
26 def find_set(self, data: T) -> DisjointSetTreeNode[T]:
27 # find the set x belongs to (with path-compression)

Callers 1

kruskalMethod · 0.45

Calls 1

DisjointSetTreeNodeClass · 0.85

Tested by

no test coverage detected