Hi all,
When manipulating a graph, I create a list of edges with a certain
relation to a vertex (they are the edges common to the vertex‘s
neighbour). I create this list at some moment in the code, and don’t
update it.
Later down the execution, I try to remove one of those edges from the
list prior to its deletion. That use to work without problem, until
today (but I have ran the code since about a month ago).
Now when I try to |remove()| the edge, I get a ValueError because python
tels me the edge is not in the list. When I look in the list, I see a
reference to an edge with the correct source and target, but a different
memory address, so I suspect that might be why it can be found…
Actually, when accessing an edge form a graph, the edge's address changes:
graph.edge(4747,2693, all_edges=True)
[<Edge objectwith source'4747' and target'2693' at0x7fd2d437c048>]
graph.edge(4747,2693, all_edges=False)
<Edge objectwith source'4747' and target'2693' at0x7fd2d437c0d8>
graph.edge(4747,2693, all_edges=False)
<Edge objectwith source'4747' and target'2693' at0x7fd2d437c168>|
Note the latest digits of the address aren't the same. I see the same
kind of things for the vertices, and it produces other bugs down the
road (like this one when trying to add an edge between two vertices):
TypeError: No registered converter was able to extract a C++ reference to type graph_tool::PythonVertexfrom this Python object of type NoneType|
What is strange is that I can't reproduce the bug in more simple
settings, where edge list is created at the same execution level as the
call to remove one of those.
I seem to recall inspecting the addresses when debugging, to check that
my object were consistent, that‘s why it’s strange that they change now.
So I'm a bit confused here…
Best,
Guillaume
attachment.html (13.8 KB)