Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
trac #27079: empty graph
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoudert committed Jan 19, 2019
1 parent 7fcd8ae commit 0a9b292
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/sage/graphs/graph_coloring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1535,23 +1535,31 @@ def acyclic_edge_coloring(g, hex_colors=False, value_only=False, k=0, solver=Non
{}
sage: acyclic_edge_coloring(g, k=None, hex_colors=False)
[]
Empty graph (:trac:`27079`)::
sage: from sage.graphs.graph_coloring import acyclic_edge_coloring
sage: acyclic_edge_coloring(Graph(), k=None, value_only=True)
0
"""
g._scream_if_not_simple(allow_multiple_edges=True)

from sage.rings.integer import Integer
from sage.combinat.subset import Subsets

if k is None:
k = max(g.degree())

if not k:
# Case of a graph without edge
if value_only:
if not g.order() or not g.size():
if value_only:
if k is None:
return 0
elif hex_colors:
return {}
elif k == 0:
return 2
else:
return []
return k
else:
return {} if hex_colors else []

if k is None:
k = max(g.degree())

while True:
try:
Expand Down

0 comments on commit 0a9b292

Please sign in to comment.