""" 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)) elif command == '4': x = int(input("vertex: ")) print("out edges: %s" % ', '.join([str(y[0]) for y in G.outboundEdges(x)])) elif command == '5': x = int(input("vertex: ")) print("in edges: %s" % ', '.join([str(y[0]) for y in G.inboundEdges(x)])) elif command == '6': x = int(input("vertex: ")) G.addNode(x) elif command == '7': x = int(input("vertex: ")) G.removeVertex(x) elif command == '8': source = int(input("source: ")) target = int(input("target: ")) weight = int(input("weight: ")) G.addEdge(source, target, weight) elif command == '9': source = int(input("source: ")) target = int(input("target: ")) G.removeEdge(source, target)