def __call__(self, chromosome: EdgeSet):
    assert isinstance(chromosome, EdgeSet), f'Chromosome must be EdgeSet type: Given was <{type(chromosome)}>'
    graph = self.stpg.graph
    disjoints = DisjointSets()
    candidates = PriorityQueue()
    result = EdgeSet()
    for v in chromosome.vertices:
        disjoints.make_set(v)
    index = randint(0, len(chromosome))
    for (i, edge) in enumerate(chromosome):
        (u, v) = edge
        if (i == index):
            candidates.push(graph.weight(u, v), (u, v))
        else:
            disjoints.union(u, v)
            result.add(u, v)
    components = disjoints.get_disjoint_sets()
    lesser_idx = min(components, key=(lambda item: len(components[item])))
    keys = (components.keys() - set([lesser_idx]))
    for key in keys:
        for v in components[lesser_idx]:
            for w in graph.adjacent_to(v):
                if (w in components[key]):
                    candidates.push(graph.weight(w, v), (v, w))
    while ((len(disjoints.get_disjoint_sets()) >= 2) or candidates):
        (w, v) = candidates.pop()
        if (disjoints.find(w) != disjoints.find(v)):
            result.add(w, v)
            disjoints.union(w, v)
    return result
def __call__(self, chromosome: EdgeSet):
    assert isinstance(chromosome, EdgeSet), f'Chromosome must be EdgeSet type: Given was <{type(chromosome)}>'
    graph = self.stpg.graph
    disjoints = DisjointSets()
    candidates = PriorityQueue()
    result = EdgeSet()
    for v in chromosome.vertices:
        disjoints.make_set(v)
    index = randint(0, len(chromosome))
    for (i, edge) in enumerate(chromosome):
        (u, v) = edge
        if (i == index):
            candidates.push(graph.weight(u, v), (u, v))
        else:
            disjoints.union(u, v)
            result.add(u, v)
    components = disjoints.get_disjoint_sets()
    lesser_idx = min(components, key=(lambda item: len(components[item])))
    keys = (components.keys() - set([lesser_idx]))
    for key in keys:
        for v in components[lesser_idx]:
            for w in graph.adjacent_to(v):
                if (w in components[key]):
                    candidates.push(graph.weight(w, v), (v, w))
    while ((len(disjoints.get_disjoint_sets()) >= 2) or candidates):
        (w, v) = candidates.pop()
        if (disjoints.find(w) != disjoints.find(v)):
            result.add(w, v)
            disjoints.union(w, v)
    return result