On Fri, Feb 4, 2011 at 11:56 PM, Johannes <dajo.m...@web.de> wrote: > Hi list > how can i add a new edge (a->b) to a given graph G (n.n. connected), > just in the case that there is no path (a -> ... -> b) before?
You should use "shortest_path" which uses Dijkstra's algorithm under the hood. if g.shortest_path('a', 'b') == []: g.add_edge('a', 'b') --Mike -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org