|
From: | Tamas Nepusz |
Subject: | Re: [igraph] Distance() |
Date: | Wed, 3 Dec 2008 11:59:51 +0000 |
Hi Marco,
Start with bfsiter() then simply break the iteration when you found your desired vertex. That's what any other uninformed shortest path algorithm would do anyway:If not, which way should i take? get_all_shortest_path doesn't let me decide the endvertex of the path, and bfsiter iters thru all vertices too.
def distance(g, v1, v2): for vertex, distance, _ in g.bfsiter(v1, advanced=True): if vertex.index == v2: return distance -- T.
[Prev in Thread] | Current Thread | [Next in Thread] |