-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
adding has_subgraph_decomposition method to GenericGraph #39598
base: develop
Are you sure you want to change the base?
Conversation
041554b
to
40cbaf3
Compare
A question I still have is whether a method |
While I was writing the code, I observed a bug in the current subgraph search which yield duplicate copies of the same subgraph. This is why I first need to create a set of rows to avoid duplicates. I created #39599 for this issue. |
Documentation preview for this PR (built with commit 40cbaf3; changes) is ready! 🎉 |
Some comments
|
sage: dlx, F = G2._subgraph_decomposition_dlx(claw, induced=True) | ||
sage: dlx | ||
Dancing links solver for 0 columns and 0 rows | ||
|
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.
remove empty line
from sage.combinat.matrices.dancing_links import dlx_solver | ||
|
||
edges = list(self.edges(labels=False)) | ||
edge_to_column_id = {frozenset(edge):i for (i,edge) in enumerate(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.
edge_to_column_id = {frozenset(edge): i for I, edge in enumerate(edges)}
|
||
EXAMPLES:: | ||
|
||
sage: from slabbe.graph import has_graph_decomposition |
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.
add path in sagemath
|
||
sage: G2.has_subgraph_decomposition(claw, induced=True) | ||
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.
remove empty line.
may be add some tests when the method is not working ? what if the graph is not simple ?
solution = dlx.one_solution(ncpus=1) | ||
has_solution = not solution is None | ||
|
||
if not 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.
if not certificate:
return has_solution
if has_solution:
return has_solution, F(solution)
return has_solution, solution
Following the question https://ask.sagemath.org/question/81610/test-if-a-graph-has-a-claw-decomposition/,
the current PR is adding a
has_subgraph_decomposition
method to the GenericGraph class.It also adds a
_subgraph_decomposition_dlx
method allowing to enumerate/count the decompositions.📝 Checklist