def __sub__(self, graph): nodes = cluster.difference(cluster.flatten(self), cluster.flatten(graph)) all = self | graph return cluster.subgraph(all, nodes, 0)
def __and__(self, graph): nodes = cluster.intersection(cluster.flatten(self), cluster.flatten(graph)) all = self | graph return cluster.subgraph(all, nodes, 0)
def flatten(self, distance=1): return cluster.flatten(self, distance)