Sage: Ticket #14536: Random tournaments, a misnamed method and a segfault
https://trac.sagemath.org/ticket/14536
<p>
<code>digraphs.Tournament</code> use to return a transitive tournament. I have no idea why I named it "tournament", as there is a wealth of tournaments on <code>n</code> vertices. Hence I rename it in this patch. I think that it does not need to be deprecated first, because the former name really is ill-adapted, and because the patch that added it was merged three months ago only. Let's not keep this bad name for another year.
</p>
<p>
The segfault is rather shameful... <code>:-P</code>
</p>
<pre class="wiki">sage: Graph(-1)
------------------------------------------------------------------------
/home/ncohen/.Sage/sage: line 135: 5163 Segmentation fault "$SAGE_ROOT/spkg/bin/sage" "$@"
</pre>en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/14536
Trac 1.1.6ncohenMon, 06 May 2013 11:07:50 GMTstatus changed; dependencies set
https://trac.sagemath.org/ticket/14536#comment:1
https://trac.sagemath.org/ticket/14536#comment:1
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>dependencies</strong>
set to <em>#14475</em>
</li>
</ul>
<p>
I also implemented an iterator over all tournaments with Nauty.
</p>
<p>
Nathann
</p>
TicketnthieryMon, 06 May 2013 13:17:24 GMT
https://trac.sagemath.org/ticket/14536#comment:2
https://trac.sagemath.org/ticket/14536#comment:2
<p>
Yo,
</p>
<p>
I just had a look, and it sounds very reasonnable.
</p>
<p>
Three details:
</p>
<ul><li>Why not displaying anymore the number of vertices in the name method of <a class="missing wiki">TransitiveTournament?</a>? Since other graphs do the same that would be consistent.
</li></ul><ul><li>A potential alternative name would be "chain"
</li></ul><ul><li>In the tournament generator using Nauty, once the nauty command is constructed, it seems that all the rest is generic (calling Nauty, parsing the output, building and yielding the graphs). What about extracting this into a generic function?
</li></ul><p>
In the long run, it would be nice to have a uniform interface for generating graphs using either Sage's engine or nauty (say with an algo=nauty/Sage optional switch, which would default to Sage, unless nauty become a standard package some day.).
</p>
<p>
Cheers,
</p>
<blockquote>
<p>
Nicolas
</p>
</blockquote>
TicketncohenMon, 06 May 2013 13:25:44 GMT
https://trac.sagemath.org/ticket/14536#comment:3
https://trac.sagemath.org/ticket/14536#comment:3
<p>
Hellooooooo !!
</p>
<blockquote class="citation">
<ul><li>Why not displaying anymore the number of vertices in the name method of <a class="missing wiki">TransitiveTournament?</a>? Since other graphs do the same that would be consistent.
</li></ul></blockquote>
<p>
Well. This is the result with the patch as it is :
</p>
<pre class="wiki">sage: digraphs.TransitiveTournament(5)
Transitive Tournament: Digraph on 5 vertices
</pre><p>
If the number of vertices is included in the name, you get "Transitive Tournament on 5 vertices: Digraph on 5 vertices".
</p>
<blockquote class="citation">
<ul><li>A potential alternative name would be "chain"
</li></ul></blockquote>
<p>
For what ? Transitive tournament ? <code>O_o</code>
</p>
<p>
Hey, it's not a Poset ! It's a digraph ! <code>:-P</code>
</p>
<p>
Plus it would really make people think of this :
</p>
<pre class="wiki">sage: digraphs.Path(5)
Path on 5 vertices: Digraph on 5 vertices
</pre><p>
Oh, by the way the name contains the number of vertices in this case. What do you think ?
</p>
<blockquote class="citation">
<ul><li>In the tournament generator using Nauty, once the nauty command is constructed, it seems that all the rest is generic (calling Nauty, parsing the output, building and yielding the graphs). What about extracting this into a generic function?
</li></ul></blockquote>
<p>
HMmmmmm. Most of it is, yes. Building the string that Nauty received as input is not, and parsing the graph is not either.. Usually Nauty returns a sparse6_string but Sage does not understand sparse6 string for digraphs yet. And there was a small difference in <a class="closed ticket" href="https://trac.sagemath.org/ticket/14474" title="enhancement: Hypergraph enumeration through Nauty (closed: fixed)">#14474</a> too.
</p>
<p>
Well, you are right a large part of it could be made automatic. It would also be the occasion to create a Nauty module, and so a documentation page about the Nauty spkg (how it is to be installed, which Demigod first wrote it.
</p>
<p>
Let's say another patch ? We still do not have the interface from Sage to Nauty's digraph generation. It's not that bad because we have Robert Miller's version in Sage, but I will probably do it someday. So I'll do both then <code>:-)</code>
</p>
<blockquote class="citation">
<p>
In the long run, it would be nice to have a uniform interface for generating graphs using either Sage's engine or nauty (say with an algo=nauty/Sage optional switch, which would default to Sage, unless nauty become a standard package some
</p>
</blockquote>
<p>
Nauty is not a part of Sage because of license problems... And it knows how to enumerate things that are not implemented in Sage yet (like hypergraphs <code>:-PPP</code>).
</p>
<p>
It goes in both directions, though. It is easy to enumerate through Sage the list of graphs satisfying some specific property, and the property is actually tested *during* the enumeration. No way to do this with Nauty, unless we *REALLY* rewrite the interface and call Nauty's C functions directly <code>:-P</code>
</p>
<p>
Nathann
</p>
TicketnthieryMon, 06 May 2013 13:46:23 GMT
https://trac.sagemath.org/ticket/14536#comment:4
https://trac.sagemath.org/ticket/14536#comment:4
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/14536#comment:3" title="Comment 3">ncohen</a>:
</p>
<blockquote class="citation">
<p>
If the number of vertices is included in the name, you get "Transitive Tournament on 5 vertices: Digraph on 5 vertices".
</p>
</blockquote>
<p>
I see. It would be consistent to fix Circuit then:
</p>
<pre class="wiki"> sage: digraphs.Circuit(5)
Circuit on 5 vertices: Digraph on 5 vertices
</pre><p>
But that can be for later.
</p>
<blockquote class="citation">
<p>
Hey, it's not a Poset ! It's a digraph !
</p>
</blockquote>
<p>
Fair enough :-)
</p>
<blockquote class="citation">
<p>
Well, you are right a large part of it could be made automatic. It would also be the occasion to create a Nauty module, and so a documentation page about the Nauty spkg (how it is to be installed, which Demigod first wrote it.
</p>
<p>
Let's say another patch ?
</p>
</blockquote>
<p>
Yup.
</p>
<blockquote class="citation">
<p>
Nauty is not a part of Sage because of license problems...
</p>
</blockquote>
<p>
I know. Maybe we should chat to Brendan about this someday.
</p>
<blockquote class="citation">
<p>
And it knows how to enumerate things that are not implemented in Sage yet (like hypergraphs <code>:-PPP</code>).
</p>
<p>
It goes in both directions, though. It is easy to enumerate through
Sage the list of graphs satisfying some specific property, and the
property is actually tested *during* the enumeration. No way to do
this with Nauty, unless we *REALLY* rewrite the interface and call
Nauty's C functions directly <code>:-P</code>
</p>
</blockquote>
<p>
Yup. Still it would be nice if there was a single entry point for
both generators, even if some features only work in one case.
</p>
<p>
Cheers,
</p>
<blockquote>
<p>
Nicolas
</p>
</blockquote>
TicketncohenMon, 06 May 2013 13:51:43 GMT
https://trac.sagemath.org/ticket/14536#comment:5
https://trac.sagemath.org/ticket/14536#comment:5
<p>
Yoooooooooo !
</p>
<blockquote class="citation">
<p>
I see. It would be consistent to fix Circuit then:
</p>
</blockquote>
<p>
Done !
</p>
<blockquote class="citation">
<blockquote class="citation">
<p>
Nauty is not a part of Sage because of license problems...
</p>
</blockquote>
<p>
I know. Maybe we should chat to Brendan about this someday.
</p>
</blockquote>
<p>
Brendan <a class="missing wiki">McKay?</a> is like MY own personnal Chuck Nurris.
He is right.
But perhaps he can decide that licensing his software under the GPL would be even greater. We would not convince him to do that, of course, but he could decide it by himself. And this would not be related in any way with our emails.
Of course.
</p>
<blockquote class="citation">
<p>
Yup. Still it would be nice if there was a single entry point for
both generators, even if some features only work in one case.
</p>
</blockquote>
<p>
Yepyep. Will do !
</p>
<p>
Nathann
</p>
TicketnthieryMon, 06 May 2013 14:06:14 GMT
https://trac.sagemath.org/ticket/14536#comment:6
https://trac.sagemath.org/ticket/14536#comment:6
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/14536#comment:5" title="Comment 5">ncohen</a>:
</p>
<blockquote class="citation">
<p>
Brendan <a class="missing wiki">McKay?</a> is like MY own personnal Chuck Nurris.
He is right.
</p>
</blockquote>
<p>
+1
</p>
<blockquote class="citation">
<p>
But perhaps he can decide that licensing his software under the GPL
would be even greater. We would not convince him to do that, of
course, but he could decide it by himself. And this would not be
related in any way with our emails.
</p>
</blockquote>
<p>
He chose the license for Nauty a while ago. In the mean time the world
of software as evolved quite some. It can be useful to him to have
feedback on what can be helpful to us and to the math open source
community at large nowadays. And then he can take whatever informed decision he wants. He is the author anyway.
</p>
<p>
Cheers,
</p>
<blockquote>
<p>
Nicolas
</p>
</blockquote>
TicketchapotonFri, 17 May 2013 08:07:11 GMTstatus changed; keywords, work_issues set
https://trac.sagemath.org/ticket/14536#comment:7
https://trac.sagemath.org/ticket/14536#comment:7
<ul>
<li><strong>keywords</strong>
<em>digraph</em> <em>tournament</em> added
</li>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
<li><strong>work_issues</strong>
set to <em>doctest</em>
</li>
</ul>
<p>
3 failing doctests need to be corrected
</p>
TicketncohenFri, 17 May 2013 08:13:17 GMTstatus changed
https://trac.sagemath.org/ticket/14536#comment:8
https://trac.sagemath.org/ticket/14536#comment:8
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
<p>
Glooooooops. Sorry. I just fixed them <code>:-/</code>
</p>
<p>
Nathann
</p>
TicketncohenFri, 17 May 2013 08:13:31 GMTattachment set
https://trac.sagemath.org/ticket/14536
https://trac.sagemath.org/ticket/14536
<ul>
<li><strong>attachment</strong>
set to <em>trac_14536.patch</em>
</li>
</ul>
TicketchapotonThu, 23 May 2013 19:21:29 GMTattachment set
https://trac.sagemath.org/ticket/14536
https://trac.sagemath.org/ticket/14536
<ul>
<li><strong>attachment</strong>
set to <em>trac_14536_review1.patch</em>
</li>
</ul>
TicketchapotonThu, 23 May 2013 19:24:46 GMT
https://trac.sagemath.org/ticket/14536#comment:9
https://trac.sagemath.org/ticket/14536#comment:9
<p>
hello,
</p>
<p>
here is a review patch. If you are happy with it, you can set a positive review on my behalf.
</p>
TicketncohenFri, 24 May 2013 08:29:27 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/14536#comment:10
https://trac.sagemath.org/ticket/14536#comment:10
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Frédéric Chapoton</em>
</li>
</ul>
<p>
Ahh..... Old PEP8 <code>:-P</code>
</p>
<p>
Thank you for this patch and the review <code>:-)</code>
</p>
<p>
Nathann
</p>
TicketjdemeyerMon, 27 May 2013 08:55:12 GMTwork_issues deleted
https://trac.sagemath.org/ticket/14536#comment:11
https://trac.sagemath.org/ticket/14536#comment:11
<ul>
<li><strong>work_issues</strong>
<em>doctest</em> deleted
</li>
</ul>
TicketjdemeyerWed, 29 May 2013 07:08:35 GMTstatus changed; resolution, merged set
https://trac.sagemath.org/ticket/14536#comment:12
https://trac.sagemath.org/ticket/14536#comment:12
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>merged</strong>
set to <em>sage-5.10.rc0</em>
</li>
</ul>
Ticket