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