Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • graph-tool graph-tool
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 48
    • Issues 48
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

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

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 choose the BUG template from the drop-down menu, and fill out the required information.

  • Tiago Peixoto
  • graph-toolgraph-tool
  • Issues
  • #188
Closed
Open
Issue created Sep 18, 2014 by paob@paul.beaujean1990

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
Assign to
Time tracking