Skip to content

avoid using numpy in graphs.RandomBipartite - #42767

Merged
vbraun merged 6 commits into
sagemath:developfrom
dcoudert:graphs/avoid_numpy_in_randombipartite
Oct 18, 2026
Merged

vbraun merged 6 commits into
sagemath:developfrom
dcoudert:graphs/avoid_numpy_in_randombipartite

Conversation

@dcoudert

@dcoudert dcoudert commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

This PR replaces a the call to numpy.uniform by a call to random in RandomBipartite. This ease the setting of the random seed. This way we avoid the need for several # needs numpy.

On the way we add parameter seed to methods HoffmanSingletonGraph and SylvesterGraph

📝 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

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

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

@fchapoton

Copy link
Copy Markdown
Contributor

ca depend d'une autre PR ?

@dcoudert

dcoudert commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

non, c'est l'inverse. Avant c'était dans #41886. Je l'ai enlevé pour avoir des PRs moins grosses. #41886 dépend de cette PR.

Comment thread src/sage/graphs/graph.py Resolved
@dcoudert
dcoudert requested a review from fchapoton October 12, 2026 11:37

@fchapoton fchapoton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok, looks reasonable

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 16, 2026
Release Manager
sagemathgh-42767: avoid using numpy in `graphs.RandomBipartite`
    
This PR replaces a the call to `numpy.uniform` by a call to `random` in
`RandomBipartite`. This ease the setting of the random seed.  This way
we avoid the need for several `# needs numpy`.

On the way we add parameter `seed` to methods `HoffmanSingletonGraph`
and `SylvesterGraph`

### 📝 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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#42767
Reported by: David Coudert
Reviewer(s): Frédéric Chapoton
@vbraun
vbraun merged commit 2a5146e into sagemath:develop Oct 18, 2026
23 of 24 checks passed
vbraun pushed a commit that referenced this pull request Oct 22, 2026
Release Manager
gh-41886: test parameter `immutable` for most graph generators
    
As discussed in
#41501 (comment), we
add tests for checking the behavior of parameter `immutable` on many
graph generators.
Tests for distance regular graphs will be added when #41723 and #41725
will be merged and some final work is done on this file. Tests for trees
will be added after #41714.

On the way, we take parameter `immutable` into account in `RingedTree`
when `vertex_labels` is `False`.

For each graph constructor, we compare the graphs obtained with
parameter immutable set to `True` and `False`. We check that these
graphs have the same set of vertices and edges. This is faster than
graph isomorphism and certainly sufficient. The tests we use support
graphs with different types of vertex labels.


### 📝 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

#42767
<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - #12345: short description why this is a dependency -->
<!-- - #34567: ... -->
    
URL: #41886
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