Repository navigation
quotient graph from the modular decomposition of a graph - #43053
Merged
Merged
Conversation
3 of 5 tasks
|
Documentation preview for this PR (built with commit 3060445; changes) is ready! 🎉 |
Collaborator
Author
|
The failing CIs are not related to this PR
|
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Oct 30, 2026
sagemathgh-43053: quotient graph from the modular decomposition of a graph Add a method to compute the quotient graph $Q$ from the modular decomposition of a graph $G$. This graph has one vertex per module of the decomposition and edges according the rules of the modular decomposition. ```sage sage: G = graphs.StarGraph(7) sage: Q = G.quotient_graph() sage: Q.order(), Q.size() (2, 1) sage: Q = G.quotient_graph(style='graph') sage: from sage.graphs.graph_decompositions.modular_decomposition import graph_from_quotient sage: H = graph_from_quotient(Q) sage: H.is_isomorphic(G) True sage: G = graphs.RandomGNP(1000, 0.002) sage: Q = G.quotient_graph(style='graph') sage: H = graph_from_quotient(Q) sage: H.is_isomorphic(G) True sage: G.order(), Q.order() (1000, 194) ``` ### 📝 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. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#43053 Reported by: David Coudert Reviewer(s):
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Oct 30, 2026
sagemathgh-43080: Fix CategoryObject type-only import lint failure The lint job on sagemath#43053 fails with Ruff TC001 because `CategoryObject` is imported only for the annotation of `R` in `src/sage/tests/type_checking/structure_returns.py`. The same failure is present on `develop`, so other PRs inherit it too. Move the import into `if TYPE_CHECKING:` and enable postponed annotations, following the adjacent type-checking modules. The return- type assertions remain unchanged. Validation: reproduced TC001 before the fix; both complete repository Ruff passes using `.github/workflows/ruff.toml` (`--no-preview` and `--preview`) pass afterward. `git diff --check` also passes. Failing job: https://github.com/sagemath/sage/actions/runs/40855714538/j ob/123386034361 URL: sagemath#43080 Reported by: Dima Pasechnik Reviewer(s): David Coudert
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Oct 31, 2026
sagemathgh-43053: quotient graph from the modular decomposition of a graph Add a method to compute the quotient graph $Q$ from the modular decomposition of a graph $G$. This graph has one vertex per module of the decomposition and edges according the rules of the modular decomposition. ```sage sage: G = graphs.StarGraph(7) sage: Q = G.quotient_graph() sage: Q.order(), Q.size() (2, 1) sage: Q = G.quotient_graph(style='graph') sage: from sage.graphs.graph_decompositions.modular_decomposition import graph_from_quotient sage: H = graph_from_quotient(Q) sage: H.is_isomorphic(G) True sage: G = graphs.RandomGNP(1000, 0.002) sage: Q = G.quotient_graph(style='graph') sage: H = graph_from_quotient(Q) sage: H.is_isomorphic(G) True sage: G.order(), Q.order() (1000, 194) ``` ### 📝 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. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#43053 Reported by: David Coudert Reviewer(s):
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Oct 31, 2026
sagemathgh-43080: Fix CategoryObject type-only import lint failure The lint job on sagemath#43053 fails with Ruff TC001 because `CategoryObject` is imported only for the annotation of `R` in `src/sage/tests/type_checking/structure_returns.py`. The same failure is present on `develop`, so other PRs inherit it too. Move the import into `if TYPE_CHECKING:` and enable postponed annotations, following the adjacent type-checking modules. The return- type assertions remain unchanged. Validation: reproduced TC001 before the fix; both complete repository Ruff passes using `.github/workflows/ruff.toml` (`--no-preview` and `--preview`) pass afterward. `git diff --check` also passes. Failing job: https://github.com/sagemath/sage/actions/runs/40855714538/j ob/123386034361 URL: sagemath#43080 Reported by: Dima Pasechnik Reviewer(s): David Coudert
5 tasks done
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Nov 7, 2026
sagemathgh-43080: Fix CategoryObject type-only import lint failure The lint job on sagemath#43053 fails with Ruff TC001 because `CategoryObject` is imported only for the annotation of `R` in `src/sage/tests/type_checking/structure_returns.py`. The same failure is present on `develop`, so other PRs inherit it too. Move the import into `if TYPE_CHECKING:` and enable postponed annotations, following the adjacent type-checking modules. The return- type assertions remain unchanged. Validation: reproduced TC001 before the fix; both complete repository Ruff passes using `.github/workflows/ruff.toml` (`--no-preview` and `--preview`) pass afterward. `git diff --check` also passes. Failing job: https://github.com/sagemath/sage/actions/runs/40855714538/j ob/123386034361 URL: sagemath#43080 Reported by: Dima Pasechnik Reviewer(s): David Coudert
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Nov 7, 2026
sagemathgh-43090: add method to compute the modular-width of a graph Now that we can compute the modular decomposition of a graph, we can compute its modular-width. ### 📝 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. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies sagemath#43053 - mostly to avoid merge conflicts URL: sagemath#43090 Reported by: David Coudert Reviewer(s): Martin Rubey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a method to compute the quotient graph$Q$ from the modular decomposition of a graph $G$ . This graph has one vertex per module of the decomposition and edges according the rules of the modular decomposition.
📝 Checklist
⌛ Dependencies