-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Overwrote methods concerning subdivision of edges in a matching covered graph #39650
base: develop
Are you sure you want to change the base?
Conversation
Documentation preview for this PR (built with commit 823c6a1; changes) is ready! 🎉 |
sage: G.get_matching() | ||
[(0, 3, None), (1, 2, None)] | ||
sage: G.subdivide_edges(G.edges(), 2) | ||
sage: G.edges() |
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.
This example is failing on some CI.
To avoid that: use a smaller example, don't show the list of edges, but the number of edges, etc.
for edge in edges: | ||
if isinstance(edge, tuple): | ||
if len(edge) <= 1: | ||
raise ValueError('need more than 1 value to unpack') |
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.
you should also print the edge to clarify the error message.
raise ValueError('expected an iterable of edges, but got a non-iterable object') | ||
|
||
for edge in edges: | ||
if isinstance(edge, tuple): |
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.
sometimes, we use list or frozenset, etc. and not only tuples.
|
||
if len(edge) == 2: | ||
u, v = edge | ||
if not self.has_edge(u, v): |
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.
this could be tested at the same time than the format of edges, no ?
M.add_edges( | ||
[(new_vertices[i * k + j], new_vertices[i * k + j + 1], l) for j in range(0, k - 1, 2)] | ||
) |
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.
M.add_edges((new_vertices[i * k + j], new_vertices[i * k + j + 1], l)
for j in range(0, k - 1, 2))
The objective of this issue is to overwrite the methods pertaining to subdivision of edges in a matching covered graph.
More specifically, this PR aims to overwrite the following methods:
subdivide_edge()
| Subdivide an edgek
times.subdivide_edges()
| Subdividek
times edges from an iterable container.This PR shall address the methods related to subdivision of edge(s) in matching covered graphs.
Fixes #38216.
Note that this issue fixes a small part of the mentioned issue.
📝 Checklist
⌛ Dependencies
Nothing as of now.
cc: @dcoudert.