New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
acyclic_edge_coloring(Graph(3), k=None, value_only=True) should not be 2, should it? #27079
Comments
comment:1
As documented, this method computes by default a coloring of For the same reason, we get the following:
But we can check that a coloring with 1 color exists
The current implementation makes it impossible to return 0. So tests for small cases must be added. |
This comment has been minimized.
This comment has been minimized.
comment:3
Indeed, I made a mistake in the description of the ticket. I corrected it now, thank you! |
comment:4
This should fix the reported issue. New commits:
|
Commit: |
Author: David Coudert |
Branch: public/27079_edgeless_graphs |
comment:5
Looks good, thank you! I think it would also be good to change the behaviour of the parameter Finally, I am not sure: should the empty graph also be allowed as input? |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:7
Right, the empty graph was leading to an error. This is now fixed. I agree that change in default behavior, if done, should be in a specific ticket. |
comment:8
I am very sorry, but I have to ask: The documentation currently says:
Apparently, when Here is a proposal: diff --git a/src/sage/graphs/graph_coloring.py b/src/sage/graphs/graph_coloring.py
index 9f0c6e47da..5b571a6eca 100644
--- a/src/sage/graphs/graph_coloring.py
+++ b/src/sage/graphs/graph_coloring.py
@@ -1546,17 +1546,21 @@ def acyclic_edge_coloring(g, hex_colors=False, value_only=False, k=0, solver=Non
from sage.rings.integer import Integer
from sage.combinat.subset import Subsets
+ from sage.plot.colors import rainbow
if not g.order() or not g.size():
if value_only:
if k is None:
return 0
- elif k == 0:
+ if k == 0:
return 2
- else:
- return k
+ return k
else:
- return {} if hex_colors else []
+ if k is None:
+ return {} if hex_colors else []
+ if k == 0:
+ k = 2
+ return {c: [] for c in rainbow(k)} if hex_colors else [g]*k
if k is None:
k = max(g.degree())
@@ -1577,8 +1581,6 @@ def acyclic_edge_coloring(g, hex_colors=False, value_only=False, k=0, solver=Non
elif not k:
k = max(g.degree()) + 2
- from sage.plot.colors import rainbow
-
p = MixedIntegerLinearProgram(solver=solver) |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:10
I have almost followed your proposal. |
Reviewer: Martin Rubey |
Changed branch from public/27079_edgeless_graphs to |
I think that the correct value for
should be 0, since there is nothing to color.
Component: graph theory
Author: David Coudert
Branch/Commit:
2996f7a
Reviewer: Martin Rubey
Issue created by migration from https://trac.sagemath.org/ticket/27079
The text was updated successfully, but these errors were encountered: