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

Function test_disjoint_set

data_structures/disjoint_set/disjoint_set.py:63–81  ·  view source on GitHub ↗

>>> test_disjoint_set()

()

Source from the content-addressed store, hash-verified

61
62
63def test_disjoint_set() -> None:
64 """
65 >>> test_disjoint_set()
66 """
67 vertex = [Node(i) for i in range(6)]
68 for v in vertex:
69 make_set(v)
70
71 union_set(vertex[0], vertex[1])
72 union_set(vertex[1], vertex[2])
73 union_set(vertex[3], vertex[4])
74 union_set(vertex[3], vertex[5])
75
76 for node0 in vertex:
77 for node1 in vertex:
78 if find_python_set(node0).isdisjoint(find_python_set(node1)):
79 assert find_set(node0) != find_set(node1)
80 else:
81 assert find_set(node0) == find_set(node1)
82
83
84if __name__ == "__main__":

Callers 1

disjoint_set.pyFile · 0.85

Calls 5

make_setFunction · 0.85
union_setFunction · 0.85
find_python_setFunction · 0.85
find_setFunction · 0.85
NodeClass · 0.70

Tested by

no test coverage detected