get_all_shortest_paths crashes python

Bug #1081458 reported by JT Bates
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
igraph
Fix Released
High
Tamás Nepusz

Bug Description

I'm using python-igraph and the interpreter crashes when I call get_all_shortest_paths and the paths have more than one edge:

$ graph.get_all_shortest_paths(2,415,'weight')
Assertion failed: (parent_path_idx >= 0), function igraph_get_all_shortest_paths_dijkstra, file ../../../src/structural_properties.c, line 5756.
Abort trap: 6

Calling shortest_paths or get_shortest_paths does not raise an error. I'm using Mac OS 10.7 and I installed python-igraph from the binary pkg.

JT Bates (jtbates)
information type: Private Security → Public
Revision history for this message
Tamás Nepusz (ntamas) wrote :

Does it happen for every such graph? I cannot reproduce it on my machine yet:

In [1]: g=Graph.GRG(100, 0.2)
In [2]: g.get_all_shortest_paths(2, 98)
Out[2]:
[[2, 11, 12, 29, 43, 68, 86, 98],
 [2, 10, 28, 45, 51, 68, 86, 98],
 [2, 11, 28, 45, 51, 68, 86, 98],
 [2, 19, 28, 45, 51, 68, 86, 98],
 [2, 11, 12, 31, 51, 68, 86, 98],
 [2, 11, 12, 29, 43, 68, 85, 98],
 [2, 10, 28, 45, 51, 68, 85, 98],
 [2, 11, 28, 45, 51, 68, 85, 98],
 [2, 19, 28, 45, 51, 68, 85, 98],
 [2, 11, 12, 31, 51, 68, 85, 98],
 [2, 11, 12, 29, 43, 68, 80, 98],
 [2, 10, 28, 45, 51, 68, 80, 98],
 [2, 11, 28, 45, 51, 68, 80, 98],
 [2, 19, 28, 45, 51, 68, 80, 98],
 [2, 11, 12, 31, 51, 68, 80, 98]]

Can you attach an example graph to this bug report on which I could reproduce the problem?

Changed in igraph:
assignee: nobody → Tamás Nepusz (ntamas)
status: New → Incomplete
Revision history for this message
JT Bates (jtbates) wrote :

No, not for every graph. This is the smallest example I could produce, the graph is attached.

In [3]: igl = igraph.load('graph.picklez')

In [4]: igl.get_all_shortest_paths(714,1200)
Out[4]: [[714, 191, 415, 1200]]

In [5]: igl.get_all_shortest_paths(714,1200,'weight')
Assertion failed: (parent_path_idx >= 0), function igraph_get_all_shortest_paths_dijkstra, file ../../../src/structural_properties.c, line 5756.
Abort trap: 6

Revision history for this message
JT Bates (jtbates) wrote :

I also noticed this error:

In [19]: grg=igraph.Graph.GRG(200,.2)

In [21]: grg.get_shortest_paths(0,0)
Out[21]: [[0]]

In [22]: grg.get_all_shortest_paths(0,0)
---------------------------------------------------------------------------
InternalError Traceback (most recent call last)
/Users/jtbates/kaggle/facebook2/<ipython-input-22-9acb10a42f35> in <module>()
----> 1 grg.get_all_shortest_paths(0,0)

InternalError: Error at ../../../src/structural_properties.c:1006: possible bug in igraph_get_all_shortest_paths, maxdist is negative, Invalid value

Should I open a separate bug report?

Revision history for this message
Tamás Nepusz (ntamas) wrote :

Thanks for the graph; there is no need to file a separate bug report, I will take care of both of these soon.

Changed in igraph:
status: Incomplete → Confirmed
importance: Undecided → High
milestone: none → 0.6.1
Revision history for this message
Tamás Nepusz (ntamas) wrote :

Seems like the bug is triggered by zero-weight edges in your graph, so you can do this as a quick workaround:

g.es.select(weight=0)["weight"] = 1e-15

Chances are that I will commit a fixed version into the trunk today so you can get the latest nightly from about 6am tomorrow (GMT) and compile that.

Changed in igraph:
status: Confirmed → In Progress
Revision history for this message
Tamás Nepusz (ntamas) wrote :

Fixed in #3066 of trunk and #3015 of 0.6-main.

Changed in igraph:
status: In Progress → Fix Committed
Changed in igraph:
status: Fix Committed → Fix Released
Revision history for this message
Gábor Csárdi (gabor.csardi) wrote : Continue on github

The development of igraph has moved to github, so please do not comment on this bug here. You are of course welcome to comment on github, here:
https://github.com/igraph/igraph/issues/125

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.