-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
Implemented methods concerning bricks and braces of a matching covered graph #39065
base: develop
Are you sure you want to change the base?
Conversation
Documentation preview for this PR (built with commit 7455ac0; changes) is ready! 🎉 |
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.
Check your code to avoid redundant operations.
Please note that for the following doctest:
It is passing in my local for the following two commands:
However, it is failing in the check for |
is the returned certificate valid ? if so, you must make the method or doctest more robust. This might be a side effect of some data structure (set, graph, etc.) that do not guaranty the order of the items. |
Yes. Both of the certificates are valid.
…On Sun, 1 Dec, 2024, 9:00 pm David Coudert, ***@***.***> wrote:
is the returned certificate valid ? if so, you must make the method or
doctest more robust. This might be a side effect of some data structure
(set, graph, etc.) that do not guaranty the order of the items.
—
Reply to this email directly, view it on GitHub
<#39065 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT2NIZGAEE2UHVDNIZYYH632DMTQ7AVCNFSM6AAAAABSZM5QQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBZHAYTMOBQGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I don't think it's a very large issue. We have You can then do e.g. manual checking that the result is in some finite list in a |
Co-authored-by: user202729 <[email protected]>
You may implement a method to check that the returned certificate is valid and use it instead of printing the certificate. |
:meth:`~sage.graphs.graph.Graph.is_bicritical` | ||
""" | ||
if self.is_bipartite(): | ||
raise ValueError('the input graph is bipartite') |
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.
why raising an error and not returning False
?
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 suppose it's more of that p → q
logic statement.
Like given a nonbipartite matching covered graph (statement p
), it is a brick if it is free of nontrivial tight cuts (statement q
).
The definition includes the term nonbipartite
. so if not p
(that is either it is bipartite or not matching covered or both), then the statement is always true.
Also, in the case of bipartite
if we return False
, we don't have any useful coNP certificate
. One may avoid this ValueError
, just by checking if it is bipartite or not before checking if it is a brick.
I might be wrong. I will be glad to have your view.
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.
Raising an error is not a good behavior here. If the issue is that you don't khave a coNP certificate, then you can return an extra boolean indicating that the input is bipartite.
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.
Good point. That's also I have thought of. But the method is_brick()
is solely defined for nonbipartite graphs and in that case, we have to return an extra boolean True
showing that the graph is nonbipartite for each valid and useful input instances of the method, which seems a bit unnecessary.
… into bricks_and_braces
@@ -2663,6 +3260,14 @@ def remove_loops(self, vertices=None): | |||
|
|||
return | |||
|
|||
@doc_index('Bricks, braces and tight cut decomposition') | |||
def tight_cut_decomposition(self): |
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.
Why are you adding this method in this PR ? It would be better to finalize this PR and then add new material in another PR.
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.
Sure. I will add tight_cut_decomposition()
in a different PR. In fact, that methods need some more work.
For now, with that method in hold, I have half implemented bricks_and_braces()
(a small method), where actually one of the outputs (that is nontrivial_odd_component
) of the above two methods (in this PR) are getting used. While doing so, I just saw that instead of returning a single nontrivial_odd_component
, if we return all possible relevant nontrivial_odd_components
in the above two methods, in other methods, the running time can be improved (even though the complexity remains the same theoretically).
H.delete_vertices([u, v]) | ||
|
||
if not H.is_matching_covered(list(matching - set([e]))): | ||
if not coNP_certificate: |
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 was just playing with some more examples and it turned out that I have not implemented the exception handling properly, yet.
For instance, if we take the original graph to be a Ladder Graph on 6 or more vertices, this check of whether that graph is matching covered raises an error instead of returning False
, as H
is not connected anymore. This one is to be checked and implemented.
The objective of this issue is to implement the methods pertaining to the bricks and brace of a matching covered graph.
More specifically, this PR aims to implement the following two methods:
bricks_and_braces()
| Return the list of (underlying simple graph of) the bricks and braces of the (matching covered) graph.is_brace()
| Check if the (matching covered) graph is a braceis_brick()
| Check if the (matching covered) graph is a brick.number_of_braces()
| Return the number of braces.number_of_bricks()
| Return the number of bricks.number_of_petersen_bricks()
| Return the number of Petersen bricks.tight_cut_decomposition()
| Return a tight cut decomposition.This PR shall address the methods related to bricks, braces and tight cut decomposition of matching covered graphs.
Fixes #38216.
Note that this issue fixes a small part of the mentioned issue.
📝 Checklist
⌛ Dependencies
This PR depends on the PR #38742 and #38892.
cc: @dcoudert.