#30728 closed enhancement (fixed)
Drawing generalizations of generalized Petersen graphs
Reported by:  Nina Klobas  Owned by:  Nina Klobas 

Priority:  major  Milestone:  sage9.3 
Component:  graph theory  Keywords:  
Cc:  vipul73921  Merged in:  
Authors:  Nina Klobas  Reviewers:  David Coudert 
Report Upstream:  N/A  Work issues:  
Branch:  0d739ba (Commits, GitHub, GitLab)  Commit:  
Dependencies:  Stopgaps: 
Description
Change History (16)
comment:1 Changed 2 years ago by
Branch:  → u/ghNinaKl/drawing_generalizations_of_generalized_petersen_graphs 

comment:2 Changed 2 years ago by
Authors:  → Nina Klobas 

Commit:  → 7f3ef45d91838eccdc0e97a524800df92b7afb79 
Component:  PLEASE CHANGE → graph theory 
Type:  PLEASE CHANGE → enhancement 
comment:3 Changed 2 years ago by
Owner:  set to Nina Klobas 

comment:4 Changed 2 years ago by
Status:  new → needs_review 

comment:5 Changed 2 years ago by
Reviewers:  → David Coudert 

Status:  needs_review → needs_work 
Hello,
Thank you for contributing new graphs with nice embeddings.
Several improvements are needed in your code (which contains errors). I'm putting below a nicer and corrected version of method IGraph
.
Use it to improve the code of the other methods.
def IGraph(n, j, k): r""" Return an Igraph with `2n` nodes. The variables `n`, `j`, `k` are integers such that `n > 2` and `0 < j, k \leq \lfloor (n  1) / 2 \rfloor`. When `j = 1` the resulting graph is isomorphic to the generalized Petersen graph with the same `n` and `k`. INPUT:  ``n``  the number of nodes is `2 * n`  ``j``  integer `0 < j \leq \lfloor (n1)/2 \rfloor`. Decides how outer vertices are connected.  ``k``  integer `0 < k \leq \lfloor (n1)/2 \rfloor`. Decides how inner vertices are connected. PLOTTING: Upon construction, the position dictionary is filled to override the springlayout algorithm. By convention, the Igraphs are displayed as an inner and outer cycle pair, with the first n nodes drawn on the outer circle. The first (0) node is drawn at the top of the outercircle, moving counterclockwise after that. The inner circle is drawn with the (n)th node at the top, then counterclockwise as well. EXAMPLES: When `j = 1` the resulting graph will be isomorphic to a generalized Petersen graph:: sage: g = graphs.IGraph(7,1,2) sage: g2 = GeneralizedPetersenGraph(7,2) sage: g.is_isomorphic(g2) True """ if n < 3: raise ValueError("n must be larger than 2") if j < 1 or j > (n  1) // 2: raise ValueError("j must be in 1 <= j <= floor((n  1) / 2)") if k < 1 or k > (n  1) // 2: raise ValueError("k must be in 1 <= k <= floor((n  1) / 2)") G = Graph(2 * n, name="Igraph (n={}, j={}, k={})".format(n, j, k)) for i in range(n): G.add_edge(i, (i + j) % n) G.add_edge(i, i + n) G.add_edge(i + n, n + (i + k) % n) G._circle_embedding(list(range(n)), radius=1, angle=pi/2) G._circle_embedding(list(range(n, 2*n)), radius=.5, angle=pi/2) return G
Could you also explain what is a IGraph
? For me this name is confusing since there is a graph library called igraph
. Is it the most appropriate name ?
comment:6 Changed 2 years ago by
Commit:  7f3ef45d91838eccdc0e97a524800df92b7afb79 → d5b51a0369da31db3078e5b5352eda52f1f581c9 

Branch pushed to git repo; I updated commit sha1. New commits:
d5b51a0  Better structure of code

comment:7 Changed 2 years ago by
Regarding the definition of Igraphs
one could check page 2 of the following paper.
comment:8 Changed 2 years ago by
You should add references to the definitions of these graphs. See e.g., #11736 for examples.
Also add a EXAMPLES:
block to all methods.
comment:9 Changed 2 years ago by
Cc:  vipul73921 added 

comment:10 Changed 2 years ago by
Milestone:  sage9.2 → sage9.3 

comment:11 Changed 2 years ago by
Branch:  u/ghNinaKl/drawing_generalizations_of_generalized_petersen_graphs → public/graphs/30728_drawings 

Commit:  d5b51a0369da31db3078e5b5352eda52f1f581c9 → a2948cdcda637ba5a43646d53ba99afcb032fe44 
Status:  needs_work → needs_review 
comment:12 Changed 2 years ago by
Commit:  a2948cdcda637ba5a43646d53ba99afcb032fe44 → 0d739ba082b679d266731e50e3709dbef5b1ee10 

Branch pushed to git repo; I updated commit sha1. New commits:
0d739ba  trac #30728: fix block issue

comment:13 Changed 2 years ago by
For me this patch is now good to go, but a double check would be appreciated.
comment:14 Changed 22 months ago by
Status:  needs_review → positive_review 

I give this ticket a positive review. I did review edit to fix some issues and we have green bot since several weeks.
comment:15 Changed 21 months ago by
Branch:  public/graphs/30728_drawings → 0d739ba082b679d266731e50e3709dbef5b1ee10 

Resolution:  → fixed 
Status:  positive_review → closed 
comment:16 Changed 21 months ago by
Commit:  0d739ba082b679d266731e50e3709dbef5b1ee10 

Some "TESTS" blocks have a single colon :
instead of double colon ::
.
Please fix in followup ticket #31461.
New commits:
Added nice drawings for 4 graph families