Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-38301: graph: modular decomposition of a single vertex should be a…
… single tree node <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> The modular decomposition tree computed by Sage for a graph with a single vertex is wrong (tested in Sage from 9.8-10.4.rc0) ```py sage: Graph(1).modular_decomposition() (PRIME, [0]) ``` Sage returns a tree with a `PRIME` root with a single child representing the vertex `0`, but according to the recursive definition of a modular decomposition tree, it should be a single node tree ([see Wikipedia for example](https://en.wikipedia.org/wiki/Modular_decomposition#:~:text=As% 20a%20base%20case%2C%20if,is%20a%20single%20tree%20node.)) This PR fixes this issue. It is an easy fix, as the case of single vertex graphs was treated separately in the `modular_decomposition` method of `Graph`. Two doctests were modified to reflect this changes. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #38301 Reported by: cyrilbouvier Reviewer(s): cyrilbouvier, David Coudert
- Loading branch information