Skip to content

add parameter immutable to graph generators in smallgraphs.py (part 1)#41501

Merged
vbraun merged 4 commits intosagemath:developfrom
dcoudert:graphs/immutable_in_smallgraph_1
Feb 1, 2026
Merged

add parameter immutable to graph generators in smallgraphs.py (part 1)#41501
vbraun merged 4 commits intosagemath:developfrom
dcoudert:graphs/immutable_in_smallgraph_1

Conversation

@dcoudert
Copy link
Copy Markdown
Collaborator

Following discussions in #39177, we add the option to return immutable graphs to some generators in src/sage/graphs/generators/smallgraphs.py.

  • HarborthGraph, Cell600, Cell120, SuzukiGraph, HallJankoGraph, BidiakisCube, BlanusaFirstSnarkGraph, BlanusaSecondSnarkGraph, BrinkmannGraph, BrouwerHaemersGraph, BuckyBall, GossetGraph, DoubleStarSnark

📝 Checklist

  • The title is concise and informative.
  • 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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 24, 2026

Documentation preview for this PR (built with commit 65d6b79; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@videlec
Copy link
Copy Markdown
Contributor

videlec commented Jan 27, 2026

This new option is tested nowhere... is that intended?

@dcoudert
Copy link
Copy Markdown
Collaborator Author

I added a few doctests.

@dcoudert
Copy link
Copy Markdown
Collaborator Author

I can do the same for the other PRs. I did not do it by default as in most of the cases it's rather straightforward and file small graphs.py contains around 100 methods...

@videlec
Copy link
Copy Markdown
Contributor

videlec commented Jan 27, 2026

Thanks.

For purpose of documentation I think it is fine to only have a bunch of them. However, for testing purposes it would be nice to have a test (via pytest?) of the form

for my_constructor, args, kwds in graph_constructors:
    G = my_constructor(*args, **kwds, immutable=False)
    # test mutable
    G = my_constructor(*args, **kwds, immutable=True)
    # test immutable

@dcoudert
Copy link
Copy Markdown
Collaborator Author

I keep this idea for a future PR, after the ongoing ones will be merged. There is still a lot of work to do for small graphs as some constructors depend on constructors from other modules that have not been touched yet (for instance to reduce potential conflicts).

@videlec
Copy link
Copy Markdown
Contributor

videlec commented Jan 27, 2026

Sounds good to me!

@dcoudert
Copy link
Copy Markdown
Collaborator Author

Thanks.

vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 30, 2026
sagemathgh-41501: add parameter immutable to graph generators in `smallgraphs.py` (part 1)
    
Following discussions in sagemath#39177, we add the option to return immutable
graphs to some generators in
`src/sage/graphs/generators/smallgraphs.py`.
- `HarborthGraph`, `Cell600`, `Cell120`, `SuzukiGraph`,
`HallJankoGraph`, `BidiakisCube`, `BlanusaFirstSnarkGraph`,
`BlanusaSecondSnarkGraph`, `BrinkmannGraph`, `BrouwerHaemersGraph`,
`BuckyBall`,  `GossetGraph`, `DoubleStarSnark`

### 📝 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.
- [ ] 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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41501
Reported by: David Coudert
Reviewer(s):
@vbraun vbraun merged commit 0843c3e into sagemath:develop Feb 1, 2026
22 of 23 checks passed
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 28, 2026
sagemathgh-41706: add parameter immutable to graph generators in `smallgraphs.py` (part 13)
    
Following discussions in sagemath#39177, and now that sagemath#41573, sagemath#41597 and sagemath#41599
have been merged, we add the option to return immutable graphs to the
remaining generators in `src/sage/graphs/generators/smallgraphs.py`.
- `DesarguesGraph`, `DurerGraph`, `MoebiusKantorGraph`, `NauruGraph`,
`MathonStronglyRegularGraph`

This concludes the work for `smallgraphs.py`.

The next step will be to add in `pytest` a generic test on all graph
generators (see
sagemath#41501 (comment)).

### 📝 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.
- [ ] 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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41706
Reported by: David Coudert
Reviewer(s): Martin Rubey
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 6, 2026
sagemathgh-41706: add parameter immutable to graph generators in `smallgraphs.py` (part 13)
    
Following discussions in sagemath#39177, and now that sagemath#41573, sagemath#41597 and sagemath#41599
have been merged, we add the option to return immutable graphs to the
remaining generators in `src/sage/graphs/generators/smallgraphs.py`.
- `DesarguesGraph`, `DurerGraph`, `MoebiusKantorGraph`, `NauruGraph`,
`MathonStronglyRegularGraph`

This concludes the work for `smallgraphs.py`.

The next step will be to add in `pytest` a generic test on all graph
generators (see
sagemath#41501 (comment)).

### 📝 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.
- [ ] 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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41706
Reported by: David Coudert
Reviewer(s): Martin Rubey
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 15, 2026
sagemathgh-41706: add parameter immutable to graph generators in `smallgraphs.py` (part 13)
    
Following discussions in sagemath#39177, and now that sagemath#41573, sagemath#41597 and sagemath#41599
have been merged, we add the option to return immutable graphs to the
remaining generators in `src/sage/graphs/generators/smallgraphs.py`.
- `DesarguesGraph`, `DurerGraph`, `MoebiusKantorGraph`, `NauruGraph`,
`MathonStronglyRegularGraph`

This concludes the work for `smallgraphs.py`.

The next step will be to add in `pytest` a generic test on all graph
generators (see
sagemath#41501 (comment)).

### 📝 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.
- [ ] 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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41706
Reported by: David Coudert
Reviewer(s): Martin Rubey
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 18, 2026
sagemathgh-41706: add parameter immutable to graph generators in `smallgraphs.py` (part 13)
    
Following discussions in sagemath#39177, and now that sagemath#41573, sagemath#41597 and sagemath#41599
have been merged, we add the option to return immutable graphs to the
remaining generators in `src/sage/graphs/generators/smallgraphs.py`.
- `DesarguesGraph`, `DurerGraph`, `MoebiusKantorGraph`, `NauruGraph`,
`MathonStronglyRegularGraph`

This concludes the work for `smallgraphs.py`.

The next step will be to add in `pytest` a generic test on all graph
generators (see
sagemath#41501 (comment)).

### 📝 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.
- [ ] 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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41706
Reported by: David Coudert
Reviewer(s): Martin Rubey
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 21, 2026
sagemathgh-41706: add parameter immutable to graph generators in `smallgraphs.py` (part 13)
    
Following discussions in sagemath#39177, and now that sagemath#41573, sagemath#41597 and sagemath#41599
have been merged, we add the option to return immutable graphs to the
remaining generators in `src/sage/graphs/generators/smallgraphs.py`.
- `DesarguesGraph`, `DurerGraph`, `MoebiusKantorGraph`, `NauruGraph`,
`MathonStronglyRegularGraph`

This concludes the work for `smallgraphs.py`.

The next step will be to add in `pytest` a generic test on all graph
generators (see
sagemath#41501 (comment)).

### 📝 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.
- [ ] 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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41706
Reported by: David Coudert
Reviewer(s): Martin Rubey
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 22, 2026
sagemathgh-41706: add parameter immutable to graph generators in `smallgraphs.py` (part 13)
    
Following discussions in sagemath#39177, and now that sagemath#41573, sagemath#41597 and sagemath#41599
have been merged, we add the option to return immutable graphs to the
remaining generators in `src/sage/graphs/generators/smallgraphs.py`.
- `DesarguesGraph`, `DurerGraph`, `MoebiusKantorGraph`, `NauruGraph`,
`MathonStronglyRegularGraph`

This concludes the work for `smallgraphs.py`.

The next step will be to add in `pytest` a generic test on all graph
generators (see
sagemath#41501 (comment)).

### 📝 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.
- [ ] 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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41706
Reported by: David Coudert
Reviewer(s): Martin Rubey
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.

3 participants