remove_edge become broken after graph save and load
Unfortunately, I can't make a reproducing code sample at the moment (may be I'll try later, i it'll be necessary). But the scenario is like this...
I have a big algorithm that makes a very long calculations on some graph and changes it during calculation somehow. Everything was OK, but I decided to save intermediate states of the graph to be able to stop and resume calculations later. After I added save/load code and debuged it a bit, I've into this:
File "...", line ... in reverse_edge self.graph.remove_edge(edge) File "/usr/lib/python3/dist-packages/graph_tool/__init__.py", line 1216, in remove_edge return libcore.remove_edge(self.__graph, edge) TypeError: No registered converter was able to extract a C++ reference to type graph_tool::PythonEdge<boost::adj_list<unsigned long> > from this Python object of type Edge
Seems very strange, it can't remove edge with type Edge. My code just gets an edge with .out_edges() function and later removes it with .remove_edge(). And doesn't change it in between.
op_out_edge = next(op.out_edges()) ... self.reverse_edge(op_out_edge) def reverse_edge(self, edge): s = edge.source() t = edge.target() self.graph.remove_edge(edge) return self.graph.add_edge(t, s)
When I comment out my save/load code (that just uses Graph.save and load_graph with adding/removing some vertex properties) everything goes OK. When I put code back, remove_edge() become broken after the first save/load.