New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
graph to_directed can have side effect when plotting #22424
Comments
Commit: |
This comment has been minimized.
This comment has been minimized.
Author: David Coudert |
comment:1
In the
Hence, the dictionary This patch solves this issue passing a copy of the position dictionary. New commits:
|
Branch: u/dcoudert/22424 |
comment:2
Nice quick find. This makes perfect sense - and I see why it didn't show up before! Thanks. You'll want to add some sort of doctest to verify that this is fixed. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:4
The problem reported in this patch is reproducible as:
So I added this test to the ticket rather than a |
comment:6
Ready for review |
comment:7
Passing a copy to the Instead, |
comment:8
In other words: do not work around the bug but fix the bug instead. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:10
This should be a better way for both graphs and digraphs. |
comment:12
Anyone to review this patch? |
comment:13
Two details:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:15
I have put back the plotting doctest and removed the trailing white space (always hard to find). |
comment:16
There is still trailing whitespace here: + The position dictionary is not the input one (:trac:`22424`)::
+
+ sage: my_pos = {0:(0,0), 1:(1,1)} <-----------------------------
+ sage: G = Graph([[0,1], [(0,1)]], pos=my_pos)
+ sage: my_pos == G._pos
+ True
+ sage: my_pos is G._pos
+ False |
Reviewer: Jeroen Demeyer |
comment:18
Sorry, removed. |
comment:20
Thank you. |
Changed branch from u/dcoudert/22424 to |
According to this ask.sagemath question, we have a very bizarre behavior for certain graphs:
gives
As if the zero vertex had been removed from
G1
. Plotting only one of them does NOT cause the error, and doing anything else seems fine. Reversing the order of the plotting givesKeyError: 5
as if the 5 vertex had never been added - in both cases it is the second plot which gives fits.See comments below.
Component: graph theory
Author: David Coudert
Branch/Commit:
64fc436
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/22424
The text was updated successfully, but these errors were encountered: