class documentation

class Partition:

View In Hierarchy

Union-find structure for maintaining disjoint sets.

Class Position A representation of a universe of elements organized into disjoint subsets.
Method find Finds the group containging p and return the position of its leader.
Method make_group Makes a new group containing element e, and returns its Position.
Method union Merges the groups containg elements p and q (if distinct).
Method _validate Undocumented
def find(self, p):

Finds the group containging p and return the position of its leader.

def make_group(self, e):

Makes a new group containing element e, and returns its Position.

def union(self, p, q):

Merges the groups containg elements p and q (if distinct).

def _validate(self, p):

Undocumented