-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
line_graph for multigraphs #39518
line_graph for multigraphs #39518
Conversation
Documentation preview for this PR (built with commit 34bece3; changes) is ready! 🎉 |
one failing doctest in
to be investigated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have other possible changes in mind, to get a faster code and to avoid calls to hash
, but we can do that a future PR. Let us first finalize this one.
A more important question is if we should directly label the vertices of the line-graph with integers instead of tuples.
In constast with the current version of line_graph, the new proposed method makes a copy of the graph g given as an input. The vertices and edges of the copy are sorted. This makes the order of the output of coarsest_equitable_refinement in the failing doctest to be slightly different (but fundamentally the same). sage: ss = (graphs.WheelGraph(5)).line_graph(labels=False) |
With the modifications proposed by @dcoudert, the PR should pass the doctests without modification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to integrate all the changes I proposed.
Also, you may add the definition you use for the line graph of a multigraph. As we discussed, we have 2 cases: connect 2 vertices if the corresponding edges are incident in
Copy of the input graph g only if g.has_multiple_edges(). New copy is called g as the input.
- Removed white spaces in blanklines (in the Examples) - Add import command for parent
In case return_labels == True, the returned dictionary is different from a previous version. An example output had to be modified accordingly.
LGTM. The only remaining issue is that comments should be formatted in 80 columns mode (should node exceed the 80th columns of the text). |
Given that this is the first Pull Request of Fabien, I suggest that this is approved right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thank you for this improvement.
We generalize the
line_graph
method to graphs possibly with multiple edges and/or loops.It is useful in order to compute the line-graph of a multigraph but also to generate the edge-colorings of a multigraph from the
all_graph_coloring
method.📝 Checklist