'Create a new empty union-find structure.
If *elements* is an iterable, this structure will be initialized
with the discrete partition on the given set of elements.'

def __init__(self, elements=None):

    if (elements is None):
        elements = ()
    self.parents = {}
    self.weights = {}
    for x in elements:
        self.weights[x] = 1
        self.parents[x] = x
