G.addEdge(source, target, weight) elif command == '9': source = int(input("source: ")) target = int(input("target: ")) G.removeEdge(source, target) elif command == '10': source = int(input("source: ")) target = int(input("target: ")) print(G.Dijkstra(source)[target]) elif command == '11': components = G.connectedComponents() for comp in components: print(comp) print("There are %i connected components." % len(components)) elif command == '12': components = G.scc() for comp in components: print(comp) print("There are %i strongly connected components." % len(components)) elif command == '0': exit(0) else: print("bad command.") command = input("> ") showMenu() # components = G.scc() #print(data['discovery']) #print(data['finish'])