Skip to content

Commit d06cacb

Browse files
committed
enable the generation of acyclic orientations with nauty_directg
1 parent 0c390a0 commit d06cacb

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/sage/graphs/digraph_generators.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,14 +649,16 @@ def nauty_directg(self, graphs, options="", debug=False):
649649
650650
INPUT:
651651
652-
- ``graphs`` -- a :class:`Graph` or an iterable containing :class:`Graph`
653-
the graph6 string of these graphs is used as an input for ``directg``.
652+
- ``graphs`` -- a :class:`Graph` or an iterable containing
653+
:class:`Graph`. The graph6 string of these graphs is used as an input
654+
for ``directg``.
654655
655656
- ``options`` (str) -- a string passed to directg as if it was run at
656657
a system command line. Available options from directg --help::
657658
658659
-e<int> | -e<int>:<int> specify a value or range of the total number of arcs
659660
-o orient each edge in only one direction, never both
661+
-a only make acyclic orientations (implies -o)
660662
-f<int> Use only the subgroup that fixes the first <int> vertices setwise
661663
-V only output graphs with nontrivial groups (including exchange of
662664
isolated vertices). The -f option is respected.
@@ -680,6 +682,19 @@ def nauty_directg(self, graphs, options="", debug=False):
680682
sage: len(list(digraphs.nauty_directg(graphs.PetersenGraph(), options="-o")))
681683
324
682684
685+
Generate non-isomorphic acyclic orientations::
686+
687+
sage: K = graphs.CompleteGraph(4)
688+
sage: all(d.is_directed_acyclic() for d in digraphs.nauty_directg(K, options='-a'))
689+
True
690+
sage: sum(1 for _ in digraphs.nauty_directg(K, options='-a'))
691+
1
692+
sage: S = graphs.StarGraph(4)
693+
sage: all(d.is_directed_acyclic() for d in digraphs.nauty_directg(S, options='-a'))
694+
True
695+
sage: sum(1 for _ in digraphs.nauty_directg(S, options='-a'))
696+
5
697+
683698
TESTS::
684699
685700
sage: g = digraphs.nauty_directg(graphs.PetersenGraph(), options="-o -G")

0 commit comments

Comments
 (0)