the order of add_edge() calls is not maintained when calling in_neighbors
Please follow the general troubleshooting steps first:
Are you running the latest
- 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
If you answered yes above, did you use the exact same compiler to build
I am currently using the latest version of graph-tool for Ubuntu 16.04, python 3.5.
This code explains the issue:
from graph_tool.all import * def pr(): print("IN: ", g.get_in_neighbors(4)) g = Graph() g.add_vertex(10) g.add_edge(2, 4) g.add_edge(0, 4) g.add_edge(1, 4) pr() g.add_edge(4, 5) pr()
- In the first call to
pr(), it shows that it maintains the order of add_edge: the in_neighbors() of vertex 4 are shown to be: [2, 0, 1].
- However, after adding an out-edge (4, 5), the order of in-neighbors of vertex 4 changes to [0, 1, 2].
Is this the intended behavior? I would expect it would maintain the order.