print "Vertex C incoming" print graph.V[2].Ei print "Vertex C outgoing" print graph.V[2].Eo print "Degree A" print graph.deg_vertex(0) print "Degree B" print graph.deg_vertex(1) print "Degree C" print graph.deg_vertex(2) print "Vertices" print graph.list_vertices() print "Edges" print graph.list_edges() print "Incident Edges A" print graph.incident_edges(0) print "Incident Edges B" print graph.incident_edges(1) print "Incident Edges C" print graph.incident_edges(2) graph.remove_vertex(0) print "\nREMOVED VERTEX A\n" print "Vertex B incoming"
ORD_PVD = graph.new_edge(ORD, PVD, value=849) ORD_DFW = graph.new_edge(ORD, DFW, value=802) DFW_LGA = graph.new_edge(DFW, LGA, value=1387) DFW_MIA = graph.new_edge(DFW, MIA, value=1120) LGA_MIA = graph.new_edge(LGA, MIA, value=1099) PVD_LGA = graph.new_edge(PVD, LGA, True, value=142) PVD_MIA = graph.new_edge(PVD, MIA, value=1205) print "Num vertices (should be 8)" print graph.num_vertices() print "\nNum edges (should be 12)" print graph.num_edges() print "\nVertices:" print graph.list_vertices() print "\nEdges:" print graph.list_edges() print "\nVertex test:" print graph.vertex(graph.list_vertices()[0].getUid()).getLabel() print "\nDegree vertices:" for i, el in enumerate(graph.list_vertices()): print "Vertex " + str(el.getLabel()) + ": " + str(graph.deg_vertex(el.getUid())) print "\nIncident Edges:" for i, el in enumerate(graph.list_vertices()): print "Vertex " + str(el.getLabel()) + ": " + str(map(lambda x: x.getValue(), graph.incident_edges(el.getUid())))