Ticket #11340 (closed defect: fixed)
Make nauty's geng work as a generator
| Reported by: | rbeezer | Owned by: | jason, ncohen, rlm |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-4.7.1 |
| Component: | graph theory | Keywords: | |
| Cc: | ncohen, fidelbarrera | Work issues: | |
| Report Upstream: | N/A | Reviewers: | Nathann Cohen |
| Authors: | Rob Beezer | Merged in: | sage-4.7.1.alpha2 |
| Dependencies: | Stopgaps: |
Description (last modified by rbeezer) (diff)
Output produced by nauty's geng program can be quite large. Currently, an entire list is created and returned. The 1,018,997,864 graphs on n=11 vertices can overwhelm RAM when produced all at once. This patch reorganizes the nauty_geng() command to produce a generator, so graphs can be created, tested and then discarded or saved - which would be the typical use of this command. Of course, for smaller values of n it is still possible to quickly build a list from the generator.
This also upgrades the system call, since os.popen() is deprecated in Python.
Apply:
Attachments
Change History
comment:1 Changed 2 years ago by rbeezer
- Cc ncohen, fidelbarrera added
- Status changed from new to needs_review
- Description modified (diff)
- Authors set to Rob Beezer
comment:2 follow-up: ↓ 3 Changed 2 years ago by ncohen
Nice patch ! :-)
Everything seems perfect, and I just have a question : what about removing the options which change the output, as the method would not be able to cast them to Sage graph ? If it is just in case the user would like to change the output with "debug = True", what about : "do not set an option to change this default or results will be unpredictable, unless debug is set to True" ?
Nathann
comment:3 in reply to: ↑ 2 Changed 2 years ago by rbeezer
- Description modified (diff)
Replying to ncohen:
I just have a question : what about removing the options which change the output, as the method would not be able to cast them to Sage graph ?
Nathann - thanks for having a look at this. That's a good point - no reason to advertise options that would be harmful. I had not taken such a close look at what I was putting there.
v2 patch is standalone, it removes these options from the list, and adds a bit more commentary about these options. I also spruced up the doctests a bit. No changes to the code.
Thanks, Rob
comment:4 follow-up: ↓ 5 Changed 2 years ago by ncohen
- Status changed from needs_review to positive_review
Goooooooood to go ! :-)
Thanks !!
Nathann

