Hello ! I'm doing calculations that involve DiGraphs, and I'd like to know whether > there's a path from one point to another. >
Did you try computing D.distance(i,j) ? Or D.shortest_path(i,j) ? I had been using > > def Conn(G,i,j): > return(G.all_paths(i,j) != []) > > But when the graphs got big, this started to take forever. > Well, you ask it to list all paths. There are more than (n-2)! paths from i to j in a complete graphs.. def Conn2(G,i,j): > return(j in Set(G.connected_component_containing_vertex(i))) > > but this treats ignores the directedness. > Use distances. And you may be interested by the four d.strongly_connected_component* functions. Nathann -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.