Skip to content

add parameter immutable to graph generators in families.py (part 4)#41592

Merged
vbraun merged 7 commits intosagemath:developfrom
dcoudert:graphs/immutable_in_families_4
Feb 11, 2026
Merged

add parameter immutable to graph generators in families.py (part 4)#41592
vbraun merged 7 commits intosagemath:developfrom
dcoudert:graphs/immutable_in_families_4

Conversation

@dcoudert
Copy link
Copy Markdown
Collaborator

@dcoudert dcoudert commented Feb 4, 2026

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

  • HararyGraph, HyperStarGraph, NKStarGraph, NStarGraph, OddGraph, PaleyGraph

To simplify the work, we add parameter name to KneserGraph and CirculantGraph

📝 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 Feb 4, 2026

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

Comment thread src/sage/graphs/generators/families.py Outdated
Copy link
Copy Markdown
Contributor

@fchapoton fchapoton left a comment

Choose a reason for hiding this comment

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

ok, merci

vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 7, 2026
sagemathgh-41592: add parameter immutable to graph generators in families.py (part 4)
    
Following discussions in sagemath#39177, we add the option to return immutable
graphs to some generators in `src/sage/graphs/generators/families.py`.
- `HararyGraph`, `HyperStarGraph`, `NKStarGraph`, `NStarGraph`,
`OddGraph`, `PaleyGraph`

To simplify the work, we add parameter `name` to `KneserGraph` and
`CirculantGraph`

### 📝 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#41592
Reported by: David Coudert
Reviewer(s): David Coudert, Frédéric Chapoton
@vbraun vbraun merged commit e87907d into sagemath:develop Feb 11, 2026
18 of 23 checks passed
cxzhong added a commit to cxzhong/sage that referenced this pull request Feb 13, 2026
* Fix AlgebraicNumberPowQQAction corner case

* First draft for sidh algrothim implimentation.

* removed the '@overide' in the very top

* removed comment after first function.

* Initial Commit for the Key Exchange API

Includes an unfinished anshel anshel goldfield implementation
and might need to refactor FiniteFieldDH to be implemented from
CommutativeKeyExchange instead.

* fixed formating with tabs and spaces

* collen after class fixed

* mean weight and transitive closure

* extremum cycle mean, documentation

* identity matrix

* identity_matrix should return a mutable matrix

* doctest is sagedoc.py

* WIP First Review Changes

- `alice_keygen` only returns public and secret key
- rename `compute_all_keys` all `do_key_exchange` and return only one shared secret key
- Type hints to `alice_keygen` and `do_key_exchange`

Co-authored-by: Vincent Macri <vincent.macri@ucalgary.ca>

* Removed anshel anshel goldfeld to Move to Different PR

* First Modifications After Review

- Moved CommutativeKeyExchange to key_exchange.py
- FiniteFieldDH uses CommutativeKeyExchange
- Added the Base suffix to the classes to indicate to users that it
    is a base class
- Added _test_key_exchange() to KeyExchangeBase
- Removed the ABC inheritance from CommutativeKeyExchangeBase
- Added __dir__ method to CommutativeKeyExchangeBase for easier
    discoverability

* Renamed key_exchange.py to key_exchange_base.py

* Fixed Ruff Lint Errors

* Made changes to how methods were called

* Fixed the public key computation for generating points

* Add tests

* Format

* Removed the runSIDH method

* Docstring cleanup

* Headers

* Update integration.pyx

* Change exception variable name from 'msg' to 'e'

* Travis' comments

* Experimental, UniqueRepresentation, parameter method

- Removed that the `KeyExchangeBase` class inherits from ABC so that we
    can inherit from `UniqueRepresentation` so testing equality can work
    properly.
- Added experimental tag to the base class.
- A Parameter Method was added so that a user can check all the
    public parameters to a given key exchange.

* Initial Commit for the Key Exchange API

Includes an unfinished anshel anshel goldfield implementation
and might need to refactor FiniteFieldDH to be implemented from
CommutativeKeyExchange instead.

* WIP First Review Changes

- `alice_keygen` only returns public and secret key
- rename `compute_all_keys` all `do_key_exchange` and return only one shared secret key
- Type hints to `alice_keygen` and `do_key_exchange`

Co-authored-by: Vincent Macri <vincent.macri@ucalgary.ca>

* Removed anshel anshel goldfeld to Move to Different PR

* First Modifications After Review

- Moved CommutativeKeyExchange to key_exchange.py
- FiniteFieldDH uses CommutativeKeyExchange
- Added the Base suffix to the classes to indicate to users that it
    is a base class
- Added _test_key_exchange() to KeyExchangeBase
- Removed the ABC inheritance from CommutativeKeyExchangeBase
- Added __dir__ method to CommutativeKeyExchangeBase for easier
    discoverability

* Renamed key_exchange.py to key_exchange_base.py

* Fixed Ruff Lint Errors

* Docstring cleanup

* Headers

* Documentation and imports (sagemath#19)

* Initial Commit for the Key Exchange API

Includes an unfinished anshel anshel goldfield implementation
and might need to refactor FiniteFieldDH to be implemented from
CommutativeKeyExchange instead.

* WIP First Review Changes

- `alice_keygen` only returns public and secret key
- rename `compute_all_keys` all `do_key_exchange` and return only one shared secret key
- Type hints to `alice_keygen` and `do_key_exchange`

Co-authored-by: Vincent Macri <vincent.macri@ucalgary.ca>

* Removed anshel anshel goldfeld to Move to Different PR

* First Modifications After Review

- Moved CommutativeKeyExchange to key_exchange.py
- FiniteFieldDH uses CommutativeKeyExchange
- Added the Base suffix to the classes to indicate to users that it
    is a base class
- Added _test_key_exchange() to KeyExchangeBase
- Removed the ABC inheritance from CommutativeKeyExchangeBase
- Added __dir__ method to CommutativeKeyExchangeBase for easier
    discoverability

* Renamed key_exchange.py to key_exchange_base.py

* Fixed Ruff Lint Errors

* Docstring cleanup

* Headers

* Documentation and imports

* Formatting

* Wording

* Update doc index

* Formatting

* Update meson.build

* Doc cleanup

* Formatting

* Wording

* Update src/sage/crypto/public_key/key_exchange/key_exchange_base.py

Co-authored-by: Brian Heckel <heckelbri@gmail.com>

---------

Co-authored-by: Brian Heckel <heckelbri@gmail.com>

* Squashed commit

* Experimental

* Formatting

* Remove UniqueRepresentation

* Typo

* made the methods that invlove building isogenies from breaking the isogeny down

* Formatting

* Typos

* Formatting

* Carlitz factorial and Bernoulli-Carlitz numbers

* Fix monte_carlo_integral to ensure issue 30379 is resolved with example tests

* SIDH cleanup (sagemath#23)

* Some cleanup

* Adjust parameters

* Cleanup

* Cleanup

* ruff format

* Some more documentation

* Parameter set generation

* More docs

* ruff format

* Docstring formatting

* ruff formatting

* Authors, copyright

* Format

* Update src/sage/crypto/public_key/key_exchange/sidh.py

Co-authored-by: Brian Heckel <heckelbri@gmail.com>

* Move some `sage.misc.latex` imports to top-level

* Add SIDH to cryptography/index.rst

* Missing return annotation

* Fix linter

* Full citation for SIKE

* add long time and func

* Formatting

* fixing links etc

* src/sage/rings/integer.pyx: rework 32/64-bit test

Rewrite one test that depends on the bitness of the machine to use the
32_bit feature tag rather than the non-standard output tags.

* src/sage/rings/polynomial/plural.pyx: rework 32/64-bit test

Rewrite one test in this file to use the 32_bit feature rather than
the (nonstandard) bitness tags on the output.

* src/sage/rings/*/multi_polynomial_libsingular.pyx: delete bad test

We are testing two separate cases for the quotient x/y in a
multivariate polynomial ring, but both answers are wrong. Rather than
combine the two cases, I think we can stop testing this bug.

* src/sage/rings/number_field/bdd_height.py: unify 32/64-bit test

* src/sage/rings/number_field/number_field.py: rework 32/64-bit test

Move the bitness tags from the output to the input in one example that
returns slightly different answers on 32- and 64-bit systems.

* src/sage/rings/number_field/totallyreal_rel.py: delete untested test

One test in this file has special cases for 32- and 64-bit systems,
but is marked "# not tested" anyway. Since we are not testing it
(it takes several minutes to run), we delete the test to avoid the
need for special cases in the output.

* src/sage/doctest/tests/longtime.rst: update bitness tags

Use "# needs 32_bit" on the input rather than "# 32-bit" on the
output, as the latter is nonstandard.

* src/sage/arith/long.pxd: update bitness tags

Use the appropriate "needs" tag on the input line rather than tagging
the output with the bitness (which is non-standard).

* src/sage/libs/singular/singular.pyx: update bitness tags

Tag the input with the bitness rather than the output; the latter is
nonstandard.

* src/sage/rings/real_arb.pyx: rework 32/64-bit tests

The one example for arb_to_mpfi() has special cases for the machine
bitness, but it's not a great example anyway. We first provide a
better example (showing that we've actually converted arb something to
mpfi something), and then rewrite the old example to tag the input
with the bitness rather than the output.

* src/sage/**/polynomial_integer_dense_ntl.pyx: combine 32/64-bit test

There's a doctest in this file that overflows on both 32- and 64-bit
systems with slightly different output, but we don't need to test that
(differing) output. We can combine the two cases with ellipses.

* src/sage/schemes/elliptic_curves/lseries_ell.py: combine 32/64-bit

One test in this file has special cases for the output on 32- and
64-bit systems, but I'm fairly sure that with two coefficients on the
order of e-19 and an abs tol of 1e-14, the remaining coefficient of
0.759316500288427 is the only one tested -- and it's the same
regardless of bitness.

* src/sage/rings/real_mpf[ir].pyx: rework 32/64-bit tags

Most of the 32- and 64-bit tags in these files are for outputs that
can only be compared as strings anyway, because there's no easy way to
input them literally. For those we replace the "32-bit" and "64-bit"
tags on the output with "needs 32_bit" and "needs !32_bit" on the
input. This is a little bit more standard.

* src/doc/en/developer/coding_basics.rst: update bitness documentation

Instead of recommending the 32-bit and 64-bit output tags (which are
nonstandard), suggest the 32_bit feature.

* src/doc/en/developer/coding_basics.rst: add a space

Make one example follow the recommendation that follows it.

* src/sage/doctest/sources.py: don't test bitness tags

These will be removed shortly.

* src/sage/doctest/sources.py: disable bitness tag processing

These have been excised from the sage library.

* feat: enable debugger in jupyter notebooks

* Apply suggestions from code review

Co-authored-by: Rubén Muñoz--Bertrand <ruben.munoz-bertrand@inria.fr>

* raise an error when the base ring is not a subset of RR

* sage/graphs/graph_database.py: compute database path only on init

Currently we compute the graphs database location when this module is
imported, but the database is not guaranteed to be present. Indeed,
the sage.features.databases.DatabaseGraphs feature exists to detect
it.

I don't know whether or not this module works (passes tests) without
the database, but now at least it is importable. This allows one to
run "pytest --doctest --collect-only" without errors on a system
where the database is not installed.

* Address reviewer comments

* Cleanup proof handling

* Typo

* Format

* specialized EllipticCurve_finite_field.division_field()

* do not cache gap twice

* documentation and tests

* fix complement

* doctest

* fix doctest; some more doc details

* Fix sagemath#41566
Since khoca interface requires a ring, no default interface instance `khoca` is provided.
`Khoca` is an alias for the instance creator.

* Fix linter error: no newline at end of file

* Off by one error

* return integer points in simplices as immutable vectors

* remove now useless lines

* make sure embedding into extension field is returned even if the embedding is the identity map

* enable jupyter debugger support in kernel template

* add doctest

* remove all deprecated stuff in modular again

* get rid of old cruft half in class_function.py

* remove some deprecated stuff in number_fields

* remove a deprecation in matrix_double_dense

* Fix out-of-bounds bitset access in Graph.add_vertex

* Fix lint: remove extra newline in test file

Co-authored-by: Dima Pasechnik <dimpase@users.noreply.github.com>

* meson: register test_add_vertex

* Fix add_vertex bounds check and follow SageMath coding style

* Guard all bitset_in calls against out-of-bounds access

* Guard all bitset_in calls with explicit bounds checks

* Fix formatting in c_graph.pyx to match Sage coding style

* Follow Sage coding style for conditional formatting in c_graph.pyx

* chore: remove stray files

* Make update-conda.py executable

so the command from the tools/README.md works

> Within an active virtual environment where `grayskull` and `conda-lock` are installed, run the following command:

> tools/update-conda.py

* update cython to 3.2.4, distlib to 0.4.0

* remove assert

* some pep8 cleanup in tensor/

* HararyGraph

* HyperStarGraph

* NKStarGraph

* NStarGraph

* OddGraph

* PaleyGraph

* sagemath#41592: fix typo

* Redoing the F4 implementation better and fixing various bugs.

* Fixing minor issues noted in reviewer comments.

* deeper cleanup in class functions

* use the upstream (linbox) patch

* Updated SageMath version to 10.9.beta6

* Update package versions and checksums for libffi, libpng, mpfr, ncurses, openssl, python3, readline, sqlite, and xz

* Fix: Add 'maxima' to the build-time dependencies of the Sage library

* Configure readline to link ncurses explicitly

Add explicit linking to ncurses for readline on Linux.

* Delete python packages

* Refactor distutils checks to use conftest.dir for temporary files and improve directory management

* Remove distros without Python 3.12+ from CI

Since Sage now requires system Python 3.12+, remove:
- ubuntu-jammy (Python 3.10)
- debian-bullseye (Python 3.9)
- debian-bookworm (Python 3.11)
- centos-stream-9 (Python 3.9)

Keep only:
- ubuntu-noble (Python 3.12)
- fedora-40 (Python 3.12)
- fedora-41 (Python 3.12/3.13)
- opensuse-tumbleweed (rolling, has Python 3.12+)

* Add python3-setuptools to distro prereqs for Python 3.12+ support

Since Python 3.12 removed distutils from the standard library, setuptools
is now required for the configure-time extension compilation tests.

- debian.txt: Add python3-setuptools and python3-venv
- opensuse.txt: Add python3-setuptools
- fedora.txt: Add python3-setuptools

* Add python3-dev/python3-devel to distro prereqs

The configure-time extension compilation tests need Python.h header.

- debian.txt: Add python3-dev
- opensuse.txt: Add python3-devel
- fedora.txt: Add python3-devel

* Add centos-stream-10 to CI distro list

CentOS Stream 10 has Python 3.12+ available, so it's compatible with
the new system Python requirement.

- docker.yml: Add centos-stream-10 to tox_system_factors
- tox.ini: Add centos-stream-10 with BASE_TAG=stream10

CentOS uses SYSTEM=fedora, so fedora.txt prereqs apply which already
have python3-devel and python3-setuptools.

* Update Fedora versions from 40/41 to 42/43 in CI

* Install setuptools for Python 3.13 on macOS CI

* Bump openssl to 3.5.5 and xz to 5.8.2

* Update cmdline tests to remove references to deleted sqlite package

* Add ubuntu-resolute and debian-trixie to CI workflow and tox environments

* Add Python packages to _bootstrap distros and restore linux-minimal CI job

* Initial plan

* Bump libpng to 1.6.53

Co-authored-by: cxzhong <14092175+cxzhong@users.noreply.github.com>

* Bump ncurses to 6.6

* Update upstream URL for ncurses in checksums.ini

* Update upstream URL for ncurses in checksums.ini

* bail out if a snake is found in local/bin

---------

Co-authored-by: user202729 <25191436+user202729@users.noreply.github.com>
Co-authored-by: Taha Hedayat <tahah22121001@gmail.com>
Co-authored-by: Brian Heckel <heckelbri@gmail.com>
Co-authored-by: Xavier Caruso <xavier@caruso.ovh>
Co-authored-by: Vincent Macri <vincent.macri@ucalgary.ca>
Co-authored-by: Chenxin Zhong <chenxin.zhong@outlook.com>
Co-authored-by: Tobias Diez <code@tobiasdiez.de>
Co-authored-by: Michael Orlitzky <michael@orlitzky.com>
Co-authored-by: Xavier Caruso <xcaruso@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Rubén Muñoz--Bertrand <ruben.munoz-bertrand@inria.fr>
Co-authored-by: Lorenz Panny <lorenz@yx7.cc>
Co-authored-by: Martin Rubey <martin.rubey@tuwien.ac.at>
Co-authored-by: MajoranaOedipus <majoranaoedipus@posteo.org>
Co-authored-by: Frédéric Chapoton <chapoton@unistra.fr>
Co-authored-by: Martin Rubey <axiomize@yahoo.de>
Co-authored-by: Harshita Yadav <seemayadavanuj123@gmail.com>
Co-authored-by: Dima Pasechnik <dimpase@users.noreply.github.com>
Co-authored-by: Julian Rüth <julian.rueth@fsfe.org>
Co-authored-by: dcoudert <david.coudert@inria.fr>
Co-authored-by: Travis Scrimshaw <tcscrims@gmail.com>
Co-authored-by: Release Manager <release@sagemath.org>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cxzhong <14092175+cxzhong@users.noreply.github.com>
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