Error computing `shortest_distance()` when vertex missing from GraphView
-
Are you running the latest graph-tool
version? -
Do you observe the problem with the current git version? -
Are you using Macports or Homebrew? If yes, please submit an issue there instead: https://github.com/Homebrew/brew/issues and https://trac.macports.org/newticket -
Did you compile graph-tool
manually? -
If you answered yes above, did you use the exact same compiler to build graph-tool
,boost-python
andPython
?
When computing shortest_distance()
(possibly other functions as well but haven't tested), if the graph supplied is a GraphView and the source vertex was filtered out of the view, an error occurs (as expected). However, the error seems to come from the C/C++ bindings and is not very easy to track to the actual problem being raised.
My operating system is Ubuntu 16.04.2 LTS and I'm running the latest version of graph tool in a conda environment. Below is a code snippet to reproduce the error.
from graph_tool import Graph, GraphView
from graph_tool.topology import shortest_distance
g = Graph()
vprop = g.new_vertex_property("string")
g.vertex_properties["foo"] = vprop
v1 = g.add_vertex()
g.vp["foo"][v1] = "boo"
v2 = g.add_vertex()
view = GraphView(g, directed=False, vfilt=lambda x:g.vp["foo"][x] == "boo")
shortest_distance(view, source=v2)
The above snippet gives the error
*** Error in `/path/to/bin/python': double free or corruption (out): 0x000055ba82d6d420 ***
I believe that instead of a low-level error the function should raise a high-level exception that the requested vertex doesn't exist in the provided graph.