Admin message

Please use the issue tracker only to report bugs (i.e. errors in the library that need to be fixed) or feature requests.

Please check if the current git version also has the same problem. An easy way to do this is to use google colab!

For questions about how to compile, install or use the library, please use instead the web forum at https://forum.skewed.de/c/graph-tool.


(If unsure, use the forum first.)


IMPORTANT: When opening new issues, please fill out the required information listed in the issue template!

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.

Assignee Loading
Time tracking Loading