from union_find import UnionFind def redundant_connection(edges): print("\tDeclaring the parent and rank lists") #declares the parent and rank list with lengths based on the edges list graph = UnionFind(len(edges)) print("\t\tParent: ", graph.parent, sep = "") print("\t\tRank: ", graph.rank, sep = "") graph.union(1, 2) graph.union(1, 3) graph.union(2, 3) def main(): edges = [ [[1, 2], [1, 3], [2, 3]] ] for i in range(len(edges)): print(i+1, ".\tEdges: ", edges[i], sep = "") redundant_connection(edges[i]) print("-" * 100) if __name__ == '__main__': main()