Closed maxale closed 2 years ago
Dependencies: #33366
Description changed:
---
+++
@@ -1 +1,4 @@
-Sage provides interface to `nauty-geng` tool via `graph.nauty_geng()`, but interface for `nauty-genbg` tool is missing.
+We add missing interface to `nauty-genbg`, a generator of bipartite graphs.
+
+Nauty's genbg was already compiled and accessible but the interface was missing.
+
Branch: public/graphs/33365_genbg
Author: David Coudert
I see that the resulting graphs are created via
G = BipartiteGraph(s[:-1], format='graph6')
Please notice that graph6
format does not bear bipartition information, and the bipartition produced by BipartiteGraph()
may be different from the requested one (via parameters n1
and n2
), especially for non-connected ones, where multiple bipartitions may exist. I believe genbg
produces the graph under assumption that left and right partite sets are formed by vertices (0..n1-1)
and (n1..n1+n2-1)
, respectively. This needs to be enforced for the resulting graphs like:
G = BipartiteGraph(s[:-1], format='graph6', partition=(set(0..n1-1),set(n1..n1+n2-1)))
I did not test this, but I hope the idea is clear.
Branch pushed to git repo; I updated commit sha1. New commits:
e57e456 | trac #33365: ensure that the partition respects the requirement |
You are right. Not easy when n1
and n2
are somewhere in the options
string...
I'm not particularly proud of my solution of parsing the auxiliary output, but it's working for as long as the user don't pass option -q (which suppress the auxiliary output).
green bot, please review.
Reviewer: Travis Scrimshaw
More of a nitpick: I think (-s, -a)
and, e.g., ">M"
should be code-formatted.
I agree that it is not that elegant, but it seems to work. If issues arise down the road, we can fix them then.
Whether or not you include my above nitpick, you can set a positive review on my behalf.
I'm not sure to understand what you asked for... I changed to (``-s``, ``-a``)
.
I prefer to avoid mentioning ">M"
. It can effectively be used to count graphs, but it's not documented and does not even appear in the source code of genbg
.
As proposed, I set this ticket to positive review.
Thanks.
Replying to @dcoudert:
I'm not sure to understand what you asked for... I changed to
(``-s``, ``-a``)
.
Yes, that’s right: code formatting is ``
.
I prefer to avoid mentioning
">M"
. It can effectively be used to count graphs, but it's not documented and does not even appear in the source code ofgenbg
.
Those kind of things were included in the doc though. Anyways, not so important.
Thank you.
Changed branch from public/graphs/33365_genbg to 695a667
Please notice that nauty-genbg
has the following restrictions on n1
and n2
:
$ nauty-genbg 5 28
>E genbg: must have n1=1..24, n1+n2=1..32
Should these restrictions be checked by the interface and an appropriate error be raised?
Yes, and these restrictions should be properly documented. Can you open a ticket ?
Added as ticket #34179.
We add missing interface to
nauty-genbg
, a generator of bipartite graphs.Nauty's genbg was already compiled and accessible but the interface was missing.
Depends on #33366
CC: @tscrim
Component: graph theory
Author: David Coudert
Branch:
695a667
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/33365