ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 01 Oct 2017 19:40:35 +0200constructing random connected graphhttps://ask.sagemath.org/question/39016/constructing-random-connected-graph/ How one can construct all possible simple connected graphs on a given number of vertices?Sun, 01 Oct 2017 17:58:31 +0200https://ask.sagemath.org/question/39016/constructing-random-connected-graph/Answer by tmonteil for <p>How one can construct all possible simple connected graphs on a given number of vertices?</p>
https://ask.sagemath.org/question/39016/constructing-random-connected-graph/?answer=39017#post-id-39017You can use `graphs.nauty_geng`, for example, if you want to iterate over all connected graphs of length 7, you can do:
sage: gen = graphs.nauty_geng("7 -c")
sage: for g in gen:
....: do some stuff with g
See `graphs.nauty_geng?` for more details.
Sun, 01 Oct 2017 19:12:43 +0200https://ask.sagemath.org/question/39016/constructing-random-connected-graph/?answer=39017#post-id-39017Comment by rewi for <p>You can use <code>graphs.nauty_geng</code>, for example, if you want to iterate over all connected graphs of length 7, you can do:</p>
<pre><code> sage: gen = graphs.nauty_geng("7 -c")
sage: for g in gen:
....: do some stuff with g
</code></pre>
<p>See <code>graphs.nauty_geng?</code> for more details.</p>
https://ask.sagemath.org/question/39016/constructing-random-connected-graph/?comment=39018#post-id-39018Thanks for replySun, 01 Oct 2017 19:40:35 +0200https://ask.sagemath.org/question/39016/constructing-random-connected-graph/?comment=39018#post-id-39018