Opened 5 years ago
Closed 5 years ago
#18530 closed enhancement (fixed)
Simplify generation of some basic graphs
Reported by:  dcoudert  Owned by:  

Priority:  minor  Milestone:  sage6.8 
Component:  graph theory  Keywords:  
Cc:  ncohen  Merged in:  
Authors:  David Coudert  Reviewers:  Nathann Cohen 
Report Upstream:  N/A  Work issues:  
Branch:  347e681 (Commits)  Commit:  347e681864be2953d5ba0bfbb2b224b4e682d441 
Dependencies:  Stopgaps: 
Description
Avoid calling networkx and then converting to sage graphs for generating very simple graphs (Bull graph, Claw Graph, etc.)
Change History (20)
comment:1 Changed 5 years ago by
 Branch set to public/18530
comment:2 Changed 5 years ago by
 Commit set to 0e527304fcef76e8e3abfae639eb1b6892d9924b
comment:3 Changed 5 years ago by
 Cc ncohen added
 Status changed from new to needs_review
I did some of them. I don't know if we need to do all of them yet ;)
comment:4 Changed 5 years ago by
 Status changed from needs_review to needs_work
Hi,
Trac ticket #18530
> :trac:`18530`
comment:5 Changed 5 years ago by
 Commit changed from 0e527304fcef76e8e3abfae639eb1b6892d9924b to 8ead714bad28ad0c5c05a7e6ffee76cc9164fd26
Branch pushed to git repo; I updated commit sha1. New commits:
8ead714  trac #18530: review

comment:7 Changed 5 years ago by
 Status changed from needs_review to needs_work
does not pass all tests :(
The order of the vertices changed in Grid2dGraph
.
comment:8 Changed 5 years ago by
 Commit changed from 8ead714bad28ad0c5c05a7e6ffee76cc9164fd26 to b1a5741414d4588000bbc74a1e6857afc2a11f26
comment:9 Changed 5 years ago by
 Commit changed from b1a5741414d4588000bbc74a1e6857afc2a11f26 to b0936f38b2d7c04b20f806634e58509c5c424338
comment:10 Changed 5 years ago by
 Status changed from needs_work to needs_review
Thanks to Nathann, I have solve all the problems.
I have not changed all the methods and there is room for further cleaning, but it's a beginning.
comment:11 Changed 5 years ago by
Helloooooooooo !
I added a commit at public/18530 (since you chose to make the branch public).
Most of the changes I made are superficial:
 Reduce the number of lines whenever possible
 Add edges from an iterator instead of a dictionary. Adding edges from a dictionary calls
add_edge
on an iterator, so it can only be slower
I also fixed a bug with ladder_graph, which was incorrect (plot it, you will see).
Most importantly, if you have never looked at paths, now is the time:
sage: graphs.PathGraph(3).show() sage: graphs.PathGraph(30).show() sage: graphs.PathGraph(100).show()
Run those three commands. You will be surprised :P
Nathann
comment:12 Changed 5 years ago by
 Commit changed from b0936f38b2d7c04b20f806634e58509c5c424338 to 9a7caee4d72344cdd107a7bf624971d842c3148b
comment:13 Changed 5 years ago by
Thanks for the corrections.
I had to update some doctests since you changed from Path Graph
to Path graph
. I had also to update the test on spring_layout
in generic_graph.py
line 15174.
And yes, the layout of the path is pretty cool ;)
comment:14 Changed 5 years ago by
 Commit changed from 9a7caee4d72344cdd107a7bf624971d842c3148b to 347e681864be2953d5ba0bfbb2b224b4e682d441
Branch pushed to git repo; I updated commit sha1. New commits:
347e681  trac #18530: update doc tests in generic_graph.py

comment:15 Changed 5 years ago by
Hmmmmmm O_o
Actually I did not mean to make that change (I just copy/pasted the first of your two lines) but it seems that all other graphs has a 'graph' and not a 'Graph', so I guess that's fine O_o
Nathnn
comment:16 Changed 5 years ago by
(and sorry for the broken doctests)
comment:17 Changed 5 years ago by
You are welcome ;)
comment:18 Changed 5 years ago by
 Reviewers set to Nathann Cohen
 Status changed from needs_review to positive_review
Wellll, then....
comment:19 Changed 5 years ago by
Thanks.
comment:20 Changed 5 years ago by
 Branch changed from public/18530 to 347e681864be2953d5ba0bfbb2b224b4e682d441
 Resolution set to fixed
 Status changed from positive_review to closed
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
trac #18530: Cycle Graph
trac #18530: Complete Graph
trac #18530: Diamond Graph
trac #18530: House Graph
trac #18530: House X Graph
trac #18530: Star Graph
trac #18530: Path Graph
trac #18530: Complete Bipartite Graph
trac #18530: Circular Ladder Graph
trac #18530: Grid 2d Graph