print("7 - remove vertex") print("8 - add edge") print("9 - remove edge") print("10 - get shortest path (Dijkstra)") print("11 - get connected components (if undirected)") print("12 - get strongly connected components (if directed)") print("0 - exit") print() showMenu() command = input("> ") while True: if command == '1': print("There are %i vertices." % G.numberOfVertices()) elif command == '2': source = int(input("source: ")) target = int(input("target: ")) G.isEdge(source, target) """ if G.isEdge(source, target): print("Edge exists.") else: print("Edge doesn't exist.") """ elif command == '3': x = int(input("vertex: ")) print("inDegree: %i" % G.inDegree(x)) print("outDegree: %i" % G.outDegree(x))