shortest_distance doesn't compute the shortest distance when a target is specified
Under graph_tool 2.2.35 I ran the following code:
from graph_tool.all import *
test = Graph()
v0 = test.add_vertex()
v1 = test.add_vertex()
v2 = test.add_vertex()
e01 = test.add_edge(v0,v1)
e02 = test.add_edge(v0,v2)
e12 = test.add_edge(v1,v2)
l = test.new_edge_property("int")
l[e01] = 3
l[e12] = 2
l[e02] = 7
import matplotlib.cm as cm
graph_draw(test, edge_color=l, edge_text=l,
vertex_text=test.vertex_index, output_size=(300,300), ecmap=cm.autumn_r)
dist_map = shortest_distance(test, v0, weights=l, directed=True)
for v in test.vertices():
print(v, dist_map[v])
print(dist_map[v2])
# prints 5
print(shortest_distance(test, v0, v2, weights=l, directed=True))
# prints 7, it looks like the shortest hop distance is computed
This has consequences on shortest_path
which can be temporarily fixed by removing the target
argument in the call to shortest_distance
.