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

Resolve nice tree decomp bug in #36843, and allow label_nice_tree_decomposition to return a digraph #36846

Merged
merged 5 commits into from
Dec 19, 2023

Conversation

guojing0
Copy link
Contributor

@guojing0 guojing0 commented Dec 9, 2023

This PR aims to resolve #36843, i.e., it now handles potential join nodes and singleton tree decomp correctly.

This PR also allows label_nice_tree_decomposition to return a directed graph, and treats the root node as a forget node, simplifying algorithm implementation.

📝 Checklist

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

⌛ Dependencies

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 13, 2023
… allow `label_nice_tree_decomposition` to return a digraph

    
This PR aims to resolve sagemath#36843, i.e., it now handles potential join
nodes and singleton tree decomp correctly.

This PR also allows `label_nice_tree_decomposition` to return a directed
graph, and treats the root node as a `forget` node, simplifying
algorithm implementation.

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [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.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36846
Reported by: Jing Guo
Reviewer(s): David Coudert, Dima Pasechnik, Jing Guo
@dcoudert
Copy link
Contributor

The difficulty is that we can have several valid solutions and we have no control on the solution we will get.

        (0, {}) forget
        (1, {0}) forget
        (2, {0, 1}) intro
        (3, {0}) forget
        (4, {0, 3}) intro
        (5, {0}) forget
        (6, {0, 2}) intro
        (7, {2}) intro
        (8, {}) leaf

or

        (0, {}) forget
        (1, {0}) forget
        (2, {0, 1}) intro
        (3, {0}) forget
        (4, {0, 2}) intro
        (5, {0}) forget
        (6, {0, 3}) intro
        (7, {2}) intro
        (8, {}) leaf

or

        (0, {}) forget
        (1, {0}) forget
        (2, {0, 3}) intro
        (3, {0}) forget
        (4, {0, 1}) intro
        (5, {0}) forget
        (6, {0, 2}) intro
        (7, {2}) intro
        (8, {}) leaf

etc.

A suggestion is to mark the for loop of the doctest as # random (with 2 spaces before #). This way it will be in the documentation but the output will not be tested.

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. LGTM.

@dcoudert
Copy link
Contributor

@antonio-rojas, is it ok for you ?

Copy link

Documentation preview for this PR (built with commit 2b6f2a9; changes) is ready! 🎉

@antonio-rojas
Copy link
Contributor

@antonio-rojas, is it ok for you ?

Yes, all tests pass now

@vbraun vbraun merged commit 5089571 into sagemath:develop Dec 19, 2023
12 of 18 checks passed
@guojing0 guojing0 deleted the fix-nice-tree-decomp branch May 23, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function make_nice_tree_decomposition returns incorrect results for $K_{3}$ and $K_{2, 5}$
5 participants