Closed Sappique closed 7 months ago
A great catch @Sappique. I'm far away from my PC until the 12th of March, so depending on how urgent this issue is to you I see three options:
A) If you are confident to make a pull request, then you can propose a patch and @04t02 and I can review it. B) Perhaps @04t02 can help out in my absence? C) I patch the library promptly after returning from holiday shortly after the the 12th.
Which do you prefer?
Sorry for the late replay @root-11.
I currently don't feel confident enough to fix the issue myself.
If someone does fix it I will be grateful, but I am currently able to use a workaround.
New release pending workflow completion...
Release 2023.6.7 available on pypi as: https://pypi.org/project/graph-theory/2023.7.6/
If one graph had a edge added and then removed again, comparing it to an identical graph can return false. This occurs it the added and removed edge is outgoing from an node that had no outgoing edges before.
To reproduce
Cause
As far as I can tell, this bug occurs, because
__eq__
compares the two graphs private edge variables_edges
instead of calling the public edge getteredges()
.When an edge from an node, that did not have any outgoing edges before, is added and removed, that edges name remains as a key in the graph's internal edge variable
_edges
. Two dictionaries are unequal if one has a key the other has not, even if all values are equal, thus the two graphs are unequal.Other examples
Because
copy()
uses the public edge getteredges()
this bug can lead to some very confusing behavior:Additional information
I'm using version 2023.7.5 of graph-theory with Python 3.10 on windows.