Init
This commit is contained in:
commit
4f5a78ac05
55 files changed
+14110
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
class DisjointValue():
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
self.parent = None
|
||||
|
||||
def canonical(self):
|
||||
if self.parent:
|
||||
return self.parent.canonical()
|
||||
return self
|
||||
|
||||
def same_set(self, other):
|
||||
return self.canonical() == other.canonical()
|
||||
|
||||
def union(self, other):
|
||||
self.canonical().parent = other.canonical()
|
||||
Reference in new issue
Block a user