MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / union_set

Class union_set

LuaSTGPlus/string2enum.py:35–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 return True
34
35class union_set:
36 def __init__(self, count):
37 self._obj = [x for x in range(0, count)]
38
39 def find(self, x):
40 if x != self._obj[x]:
41 self._obj[x] = self.find(self._obj[x])
42 return self._obj[x]
43 else:
44 return x
45
46 def connect(self, a, b):
47 x = self.find(a)
48 y = self.find(b)
49 self._obj[x] = y
50
51 def is_connected(self, a, b):
52 return self.find(a) == self.find(b)
53
54# find best indices
55# !!NEED TO BE IMPROVED!!

Callers 1

generate_graphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected