Skip to content

Commit 816cc88

Browse files
Saatvik RaosaatvikraoIITGN
authored andcommitted
tests for graphs with no edges
1 parent 7c4492a commit 816cc88

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/sage/graphs/orientations.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@ def acyclic_orientations(G):
9292
To count the number of acyclic orientations for a graph with 0 vertices::
9393
9494
sage: list(Graph().acyclic_orientations())
95-
[Graph on 0 vertices]
95+
[]
9696
9797
To count the number of acyclic orientations for a graph with 1 vertex::
9898
9999
sage: list(Graph(1).acyclic_orientations())
100-
[Graph on 0 vertices]
100+
[]
101101
102102
To count the number of acyclic orientations for a graph with 2 vertices::
103103
104104
sage: list(Graph(2).acyclic_orientations())
105-
[Graph on 0 vertices]
105+
[]
106106
107107
Acyclic orientations of a complete graph::
108108
@@ -127,6 +127,10 @@ def acyclic_orientations(G):
127127
6
128128
129129
"""
130+
if not G.size():
131+
# A graph without edge cannot be oriented
132+
return
133+
130134
from sage.rings.infinity import Infinity
131135
from sage.combinat.subset import Subsets
132136

0 commit comments

Comments
 (0)