Skip to content
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

sage.graphs: Eliminate use of sage.plot.colors when not plotting #35777

Open
mkoeppe opened this issue Jun 15, 2023 · 3 comments
Open

sage.graphs: Eliminate use of sage.plot.colors when not plotting #35777

mkoeppe opened this issue Jun 15, 2023 · 3 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 15, 2023

Currently, at least sage.graphs.graph_coloring uses it outside of a plotting context, which makes packaging (#35095) awkward

@dcoudert

@dcoudert
Copy link
Contributor

We use method rainbow in sage.graphs.graph_coloring. It's useful here to assign colors to vertices or edges that may later be plotted.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 15, 2023

Yes, I saw that. Would it be possible to defer this assignment somehow?

@dcoudert
Copy link
Contributor

Removing calls to rainbow from sage.graphs.graph_coloring is not easy. It would require to get surrounding methods in (at least) graph.py to assign colors.

I will check the feasibility of making methods in sage.graphs.graph_coloring return color classes only (or a number for counting) and to add a method in charge of turning the color classes to the desired format: color classes (do nothing), mapping vertex to color, mapping color to vertices. This way, calls to rainbow would be contained in a single method.

vbraun pushed a commit that referenced this issue Jun 21, 2023
We add a method to format colorings to reduce the number of places in
which method rainbow from `sage.plot.colors` is called in
`sage.graphs.graph_coloring`.

This is a first step toward the resolution of #35777

### 📝 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

URL: #35780
Reported by: David Coudert
Reviewer(s): Matthias Köppe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants