Closed dbvdb closed 5 years ago
Indeed, nodes are assumed to be all of the same type and sortable. Looking at this code again, I wonder if maybe we can just get rid of _sorted_tuple
and do sth like this:
def __eq__(self, other):
try:
return self.elements == other.elements
except AttributeError:
a, b = other
return self.elements == (a, b) or self.elements == (b, a)
Fixed in 58ff2e1.
I have kept _sorted_tuple
for now: it ensures that the ranking of node pairs is always the same, even in case of ties.