canonaut 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. canonaut-1.0.0/.github/workflows/ci.yml +110 -0
  2. canonaut-1.0.0/.github/workflows/release-python.yml +110 -0
  3. canonaut-1.0.0/.gitignore +32 -0
  4. canonaut-1.0.0/.zenodo.json +36 -0
  5. canonaut-1.0.0/CHANGELOG.md +62 -0
  6. canonaut-1.0.0/CITATION.cff +44 -0
  7. canonaut-1.0.0/CONTRIBUTING.md +55 -0
  8. canonaut-1.0.0/Cargo.lock +792 -0
  9. canonaut-1.0.0/Cargo.toml +52 -0
  10. canonaut-1.0.0/LICENSE +202 -0
  11. canonaut-1.0.0/NOTICE +11 -0
  12. canonaut-1.0.0/PKG-INFO +116 -0
  13. canonaut-1.0.0/README.md +307 -0
  14. canonaut-1.0.0/assets/logo-dark.png +0 -0
  15. canonaut-1.0.0/assets/logo-dark.svg +33 -0
  16. canonaut-1.0.0/assets/logo-mark.svg +30 -0
  17. canonaut-1.0.0/assets/logo.png +0 -0
  18. canonaut-1.0.0/assets/logo.svg +33 -0
  19. canonaut-1.0.0/benches/bench.rs +312 -0
  20. canonaut-1.0.0/benches/c_memcheck.c +82 -0
  21. canonaut-1.0.0/benches/c_nauty_helper.c +51 -0
  22. canonaut-1.0.0/bindings/python/Cargo.toml +14 -0
  23. canonaut-1.0.0/bindings/python/README.md +94 -0
  24. canonaut-1.0.0/bindings/python/src/lib.rs +256 -0
  25. canonaut-1.0.0/bindings/python/tests/test_canonaut.py +137 -0
  26. canonaut-1.0.0/build.rs +18 -0
  27. canonaut-1.0.0/examples/logo.rs +221 -0
  28. canonaut-1.0.0/pyproject.toml +34 -0
  29. canonaut-1.0.0/python/canonaut/__init__.py +243 -0
  30. canonaut-1.0.0/repro/README.md +71 -0
  31. canonaut-1.0.0/repro/allocation_data.csv +29 -0
  32. canonaut-1.0.0/repro/benchmark_data.csv +115 -0
  33. canonaut-1.0.0/repro/collect_criterion.py +109 -0
  34. canonaut-1.0.0/repro/make_tables.py +135 -0
  35. canonaut-1.0.0/repro/measure_memory.sh +86 -0
  36. canonaut-1.0.0/repro/memory_data.csv +56 -0
  37. canonaut-1.0.0/repro/memory_usage.pdf +0 -0
  38. canonaut-1.0.0/repro/performance_speedup.pdf +0 -0
  39. canonaut-1.0.0/repro/plot_figures.py +198 -0
  40. canonaut-1.0.0/repro/tables.tex +71 -0
  41. canonaut-1.0.0/setup.sh +131 -0
  42. canonaut-1.0.0/src/bin/compare_stats.rs +133 -0
  43. canonaut-1.0.0/src/bin/memcheck.rs +106 -0
  44. canonaut-1.0.0/src/bin/profile.rs +121 -0
  45. canonaut-1.0.0/src/bit_ops.rs +13 -0
  46. canonaut-1.0.0/src/consts.rs +1 -0
  47. canonaut-1.0.0/src/generators.rs +245 -0
  48. canonaut-1.0.0/src/graph6.rs +324 -0
  49. canonaut-1.0.0/src/io.rs +296 -0
  50. canonaut-1.0.0/src/lib.rs +56 -0
  51. canonaut-1.0.0/src/refine.rs +959 -0
  52. canonaut-1.0.0/src/rng.rs +143 -0
  53. canonaut-1.0.0/src/search.rs +1527 -0
  54. canonaut-1.0.0/src/simd_ops.rs +95 -0
  55. canonaut-1.0.0/src/structs/bitset.rs +314 -0
  56. canonaut-1.0.0/src/structs/graph.rs +444 -0
  57. canonaut-1.0.0/src/structs/manager.rs +754 -0
  58. canonaut-1.0.0/src/structs/schreier_arena.rs +582 -0
  59. canonaut-1.0.0/src/structs/target_cell.rs +105 -0
  60. canonaut-1.0.0/src/structs.rs +9 -0
  61. canonaut-1.0.0/src/support.rs +714 -0
  62. canonaut-1.0.0/src/test_vectors.rs +421 -0
  63. canonaut-1.0.0/src/tests.rs +1211 -0
  64. canonaut-1.0.0/src/utilities.rs +167 -0
  65. canonaut-1.0.0/test_data/smoke/all_9.g6 +300 -0
  66. canonaut-1.0.0/test_data/smoke/all_9.ref +0 -0
  67. canonaut-1.0.0/test_data/smoke/biconnected_9.g6 +150 -0
  68. canonaut-1.0.0/test_data/smoke/biconnected_9.ref +0 -0
  69. canonaut-1.0.0/test_data/smoke/bipartite_10.g6 +200 -0
  70. canonaut-1.0.0/test_data/smoke/bipartite_10.ref +0 -0
  71. canonaut-1.0.0/test_data/smoke/chordal_9.g6 +150 -0
  72. canonaut-1.0.0/test_data/smoke/chordal_9.ref +0 -0
  73. canonaut-1.0.0/test_data/smoke/clawfree_9.g6 +150 -0
  74. canonaut-1.0.0/test_data/smoke/clawfree_9.ref +0 -0
  75. canonaut-1.0.0/test_data/smoke/connected_10.g6 +200 -0
  76. canonaut-1.0.0/test_data/smoke/connected_10.ref +0 -0
  77. canonaut-1.0.0/test_data/smoke/cubic_10.g6 +21 -0
  78. canonaut-1.0.0/test_data/smoke/cubic_10.ref +0 -0
  79. canonaut-1.0.0/test_data/smoke/k4free_9.g6 +150 -0
  80. canonaut-1.0.0/test_data/smoke/k4free_9.ref +0 -0
  81. canonaut-1.0.0/test_data/smoke/large_127.g6 +3 -0
  82. canonaut-1.0.0/test_data/smoke/large_127.ref +0 -0
  83. canonaut-1.0.0/test_data/smoke/large_128.g6 +3 -0
  84. canonaut-1.0.0/test_data/smoke/large_128.ref +0 -0
  85. canonaut-1.0.0/test_data/smoke/large_129.g6 +3 -0
  86. canonaut-1.0.0/test_data/smoke/large_129.ref +0 -0
  87. canonaut-1.0.0/test_data/smoke/large_63.g6 +4 -0
  88. canonaut-1.0.0/test_data/smoke/large_63.ref +0 -0
  89. canonaut-1.0.0/test_data/smoke/large_64.g6 +4 -0
  90. canonaut-1.0.0/test_data/smoke/large_64.ref +0 -0
  91. canonaut-1.0.0/test_data/smoke/large_65.g6 +4 -0
  92. canonaut-1.0.0/test_data/smoke/large_65.ref +0 -0
  93. canonaut-1.0.0/test_data/smoke/perfect_9.g6 +150 -0
  94. canonaut-1.0.0/test_data/smoke/perfect_9.ref +0 -0
  95. canonaut-1.0.0/test_data/smoke/random_mixed.g6 +63 -0
  96. canonaut-1.0.0/test_data/smoke/random_mixed.ref +0 -0
  97. canonaut-1.0.0/test_data/smoke/regular4_10.g6 +60 -0
  98. canonaut-1.0.0/test_data/smoke/regular4_10.ref +0 -0
  99. canonaut-1.0.0/test_data/smoke/split_10.g6 +150 -0
  100. canonaut-1.0.0/test_data/smoke/split_10.ref +0 -0
  101. canonaut-1.0.0/test_data/smoke/triangle_free_11.g6 +200 -0
  102. canonaut-1.0.0/test_data/smoke/triangle_free_11.ref +0 -0
  103. canonaut-1.0.0/tools/gen_g6_vectors.py +146 -0
  104. canonaut-1.0.0/tools/gen_large_g6.py +65 -0
  105. canonaut-1.0.0/tools/gen_random_g6.py +37 -0
  106. canonaut-1.0.0/tools/gen_smoke_corpus.py +105 -0
  107. canonaut-1.0.0/tools/gen_test_vectors.py +338 -0
@@ -0,0 +1,110 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ test:
14
+ name: test (${{ matrix.os }}, ${{ matrix.toolchain }})
15
+ runs-on: ${{ matrix.os }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, macos-latest, windows-latest]
20
+ toolchain: [stable]
21
+ include:
22
+ # Minimum supported Rust version, as declared in Cargo.toml / the paper.
23
+ - os: ubuntu-latest
24
+ toolchain: "1.85"
25
+ steps:
26
+ - uses: actions/checkout@v5
27
+ - uses: dtolnay/rust-toolchain@master
28
+ with:
29
+ toolchain: ${{ matrix.toolchain }}
30
+ - uses: Swatinem/rust-cache@v2
31
+ # test_data/smoke/ is committed, so the pynauty cross-validation runs
32
+ # here without installing nauty or Python.
33
+ #
34
+ # The MSRV applies to what a consumer builds: the library and its
35
+ # binaries. The benchmark harness (Criterion) is a dev-dependency and
36
+ # requires a newer toolchain than canonaut itself, so the MSRV job checks
37
+ # the library only.
38
+ - run: cargo test --all-targets
39
+ if: matrix.toolchain == 'stable'
40
+ - run: cargo test --doc
41
+ if: matrix.toolchain == 'stable'
42
+ - run: cargo check --lib --bins
43
+ if: matrix.toolchain != 'stable'
44
+
45
+ lint:
46
+ name: fmt + clippy
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v5
50
+ - uses: dtolnay/rust-toolchain@stable
51
+ with:
52
+ components: rustfmt, clippy
53
+ - uses: Swatinem/rust-cache@v2
54
+ # Advisory until the tree has been run through `cargo fmt` once; the
55
+ # clippy gate below is enforced.
56
+ - run: cargo fmt --all --check
57
+ continue-on-error: true
58
+ - run: cargo clippy --all-targets -- -D warnings
59
+
60
+ miri:
61
+ name: miri (undefined-behaviour check)
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - uses: actions/checkout@v5
65
+ - uses: dtolnay/rust-toolchain@nightly
66
+ with:
67
+ components: miri
68
+ - uses: Swatinem/rust-cache@v2
69
+ # Corpus sweeps and the repetition-heavy tests are far too slow under
70
+ # Miri; the subset below still enters every unsafe code path — the
71
+ # word-count-specialised automorphism check, the vertex-permutation
72
+ # routine and the bitset primitives — via
73
+ # tests::test_word_boundary_paths (m = 1, 2, 3, 4). ~7 min.
74
+ - run: >
75
+ cargo miri test --lib --
76
+ --skip g6 --skip large --skip smoke --skip fuzz
77
+ --skip hard_instances --skip test_graphs --skip test_random --skip test_known
78
+ env:
79
+ MIRIFLAGS: -Zmiri-disable-isolation
80
+
81
+ cross-validate:
82
+ name: full pynauty cross-validation
83
+ runs-on: ubuntu-latest
84
+ steps:
85
+ - uses: actions/checkout@v5
86
+ - uses: dtolnay/rust-toolchain@stable
87
+ - uses: Swatinem/rust-cache@v2
88
+ - name: Install nauty (geng/genbg) and pynauty
89
+ run: |
90
+ sudo apt-get update
91
+ sudo apt-get install -y nauty
92
+ python3 -m pip install --upgrade pip
93
+ python3 -m pip install pynauty networkx
94
+ - name: Regenerate the full corpora and run every test
95
+ run: ./setup.sh
96
+
97
+ python:
98
+ name: python bindings
99
+ runs-on: ubuntu-latest
100
+ steps:
101
+ - uses: actions/checkout@v5
102
+ - uses: dtolnay/rust-toolchain@stable
103
+ - uses: actions/setup-python@v5
104
+ with:
105
+ python-version: "3.9"
106
+ - run: pip install maturin pytest networkx
107
+ - run: maturin build --release --out dist
108
+ working-directory: bindings/python
109
+ - run: pip install --find-links bindings/python/dist canonaut
110
+ - run: pytest bindings/python/tests -v
@@ -0,0 +1,110 @@
1
+ name: Release Python wheels
2
+
3
+ # Builds canonaut wheels for every supported platform and publishes them to
4
+ # PyPI when a tag is pushed. Because the extension is built abi3-py39, one
5
+ # wheel per platform covers CPython 3.9 and later, so the matrix stays small.
6
+ #
7
+ # Publishing uses PyPI Trusted Publishing (OIDC): no API token is stored in the
8
+ # repository. Register the publisher once at
9
+ # https://pypi.org/manage/account/publishing/ with
10
+ # owner: um-univie
11
+ # repository: canonaut
12
+ # workflow: release-python.yml
13
+ # environment: pypi
14
+ # (as a "pending publisher" before the project's first release).
15
+
16
+ on:
17
+ push:
18
+ tags: ["v*"]
19
+ workflow_dispatch:
20
+
21
+ permissions:
22
+ contents: read
23
+
24
+ jobs:
25
+ wheels:
26
+ name: wheel (${{ matrix.platform.runner }}, ${{ matrix.platform.target }})
27
+ runs-on: ${{ matrix.platform.runner }}
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ platform:
32
+ - runner: ubuntu-latest
33
+ target: x86_64
34
+ - runner: ubuntu-latest
35
+ target: aarch64
36
+ - runner: macos-latest
37
+ target: aarch64
38
+ # GitHub retired the Intel macOS runners, so the x86_64 wheel is
39
+ # cross-compiled from the Apple-silicon runner.
40
+ - runner: macos-latest
41
+ target: x86_64
42
+ - runner: windows-latest
43
+ target: x64
44
+ steps:
45
+ - uses: actions/checkout@v5
46
+ - uses: actions/setup-python@v5
47
+ with:
48
+ python-version: "3.9"
49
+ - name: Build wheel
50
+ uses: PyO3/maturin-action@v1
51
+ with:
52
+ target: ${{ matrix.platform.target }}
53
+ args: --release --out dist --manifest-path bindings/python/Cargo.toml
54
+ manylinux: auto
55
+ - uses: actions/upload-artifact@v4
56
+ with:
57
+ name: wheels-${{ matrix.platform.runner }}-${{ matrix.platform.target }}
58
+ path: dist
59
+
60
+ sdist:
61
+ name: source distribution
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - uses: actions/checkout@v5
65
+ - name: Build sdist
66
+ uses: PyO3/maturin-action@v1
67
+ with:
68
+ command: sdist
69
+ args: --out dist --manifest-path bindings/python/Cargo.toml
70
+ - uses: actions/upload-artifact@v4
71
+ with:
72
+ name: wheels-sdist
73
+ path: dist
74
+
75
+ smoke-test:
76
+ name: install and test the built wheel
77
+ needs: [wheels]
78
+ runs-on: ubuntu-latest
79
+ steps:
80
+ - uses: actions/checkout@v5
81
+ - uses: actions/setup-python@v5
82
+ with:
83
+ python-version: "3.9"
84
+ - uses: actions/download-artifact@v4
85
+ with:
86
+ name: wheels-ubuntu-latest-x86_64
87
+ path: dist
88
+ - run: pip install --find-links dist canonaut pytest networkx
89
+ - run: pytest bindings/python/tests -v
90
+
91
+ publish:
92
+ name: publish to PyPI
93
+ needs: [wheels, sdist, smoke-test]
94
+ runs-on: ubuntu-latest
95
+ if: startsWith(github.ref, 'refs/tags/')
96
+ environment: pypi
97
+ permissions:
98
+ id-token: write # required for Trusted Publishing
99
+ steps:
100
+ - uses: actions/download-artifact@v4
101
+ with:
102
+ pattern: wheels-*
103
+ merge-multiple: true
104
+ path: dist
105
+ # Tolerate files that are already on PyPI (for instance a wheel uploaded
106
+ # by hand before the workflow existed): the remaining artifacts still go
107
+ # up, and the release does not fail over a duplicate.
108
+ - uses: pypa/gh-action-pypi-publish@release/v1
109
+ with:
110
+ skip-existing: true
@@ -0,0 +1,32 @@
1
+ /target
2
+ /publication
3
+
4
+ # Profiling artifacts
5
+ profile.json
6
+ profile2.json
7
+
8
+ # macOS artifacts
9
+ .DS_Store
10
+ "__.SYMDEF SORTED"
11
+
12
+ # Project management (local scratch, never committed)
13
+ todo.txt
14
+ TODO.local.md
15
+
16
+ # Regenerated by ./setup.sh — see setup.sh and tools/gen_*.py.
17
+ # test_data/smoke/ is the committed subset used by the default `cargo test`
18
+ # run (see tools/gen_smoke_corpus.py) and is deliberately not ignored.
19
+ /test_data/*.g6
20
+ /test_data/*.ref
21
+ /.venv-testdata/
22
+
23
+ # repro/ keeps the measurement data and the scripts; the PNG previews are
24
+ # regenerated from them by repro/plot_figures.py (the PDFs the paper includes
25
+ # are kept).
26
+ /repro/*.png
27
+
28
+ # Python bindings (bindings/python) build artifacts
29
+ bindings/python/.venv/
30
+ bindings/python/python/canonaut/*.so
31
+ bindings/python/python/canonaut/__pycache__/
32
+ **/__pycache__/
@@ -0,0 +1,36 @@
1
+ {
2
+ "title": "canonaut: A Safe Rust Implementation of the nauty Graph Canonicalization Algorithm",
3
+ "description": "<p>canonaut is a native, memory-safe Rust implementation of the nauty graph canonicalization and automorphism-group algorithm (McKay 1981; McKay &amp; Piperno 2014). Canonical forms are byte-identical to those of C nauty, so canonical hashes computed by the two are interchangeable. The library supports dense graphs, canonical labeling, vertex-coloured (partitioned) canonicalization, digraphs, automorphism group generators, graph6 I/O and the Schreier&ndash;Sims stabiliser chain, and ships Python bindings of the same name with arbitrary hashable node labels and networkx interoperability.</p><p>This deposit is the archived snapshot accompanying the SoftwareX article, and includes the reproducible capsule in <code>repro/</code>, which regenerates every table and figure of the paper.</p>",
4
+ "upload_type": "software",
5
+ "license": "apache-2.0",
6
+ "access_right": "open",
7
+ "creators": [
8
+ {
9
+ "name": "Uhlir, Manuel",
10
+ "orcid": "0009-0002-7720-2316",
11
+ "affiliation": "Institute of Theoretical Chemistry, Faculty of Chemistry, University of Vienna, Austria"
12
+ },
13
+ {
14
+ "name": "Flamm, Christoph",
15
+ "orcid": "0000-0001-5500-2415",
16
+ "affiliation": "Institute of Theoretical Chemistry, Faculty of Chemistry, University of Vienna, Austria"
17
+ }
18
+ ],
19
+ "keywords": [
20
+ "graph canonicalization",
21
+ "automorphism group",
22
+ "graph isomorphism",
23
+ "nauty",
24
+ "Rust",
25
+ "combinatorics",
26
+ "cheminformatics"
27
+ ],
28
+ "related_identifiers": [
29
+ {
30
+ "identifier": "https://github.com/um-univie/canonaut",
31
+ "relation": "isSupplementTo",
32
+ "scheme": "url"
33
+ }
34
+ ],
35
+ "notes": "Funded by the Novo Nordisk Foundation, Challenge Programme 2021 (MATOMIC, NNF21OC0066551). M.U. acknowledges support from the Vienna Doctoral School in Chemistry (DoSChem)."
36
+ }
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+
11
+ - `test_data/smoke/`: a committed 1 965-graph cross-validation corpus with
12
+ pynauty reference canonical forms, so a plain `cargo test` on a fresh clone
13
+ verifies canonical forms against C nauty without running `./setup.sh`
14
+ (`tools/gen_smoke_corpus.py`).
15
+ - `repro/`: scripts that regenerate every number and figure in the paper
16
+ (`collect_criterion.py`, `make_tables.py`, `plot_figures.py`,
17
+ `measure_memory.sh`) together with the collected measurement data.
18
+ - `src/bin/memcheck` reports heap traffic through a counting global allocator,
19
+ separating set-up allocations from steady-state ones.
20
+ - Continuous integration (`.github/workflows/ci.yml`): tests on Linux/macOS/
21
+ Windows, MSRV 1.85, clippy, Miri, the full pynauty cross-validation, and the
22
+ Python bindings.
23
+ - `CITATION.cff`.
24
+ - Refinement-blind graph generators (`canonaut::generators`): Cai-Fürer-Immerman
25
+ graphs over the 3-regular circulant (twisted and untwisted), Sylvester
26
+ Hadamard bipartite graphs, and Paley graphs — plus a `hard` benchmark group
27
+ and tests that use them as ground truth (twisted and untwisted CFI graphs
28
+ must receive different canonical forms; |Aut| of the Paley graph on q
29
+ vertices must be q(q-1)/2).
30
+ - `tests::test_word_boundary_paths`: fast canonicalizations covering
31
+ m = 1, 2, 3, 4 words per vertex — the subset the Miri CI job runs.
32
+
33
+ ### Changed
34
+
35
+ - Graph generators moved from `canonaut::tests` to `canonaut::generators`; the
36
+ test suite and its fixtures are now `#[cfg(test)]` and no longer part of the
37
+ published library.
38
+ - Corpus-driven tests skip with a message instead of failing when the
39
+ (uncommitted) full corpora have not been regenerated.
40
+
41
+ ### Fixed
42
+
43
+ - Short-prune condition in the automorphism-processing branches compared
44
+ `gca_canonical_level` with itself, so `needs_short_prune` was never set. It
45
+ now compares against `gca_first_level`, matching nauty's
46
+ `if (gca_canon != gca_first) needshortprune = TRUE`.
47
+ - `fmperm_safe` allocated an `n`-byte visited array on every call for n > 64,
48
+ i.e. once per automorphism found; it now uses a thread-local scratch buffer,
49
+ making steady-state canonicalization allocation-free at every tested size.
50
+
51
+ ### Removed
52
+
53
+ - Dead C-translation leftovers `itos`, `writeperm`, `fmperm` and `alloc_error`
54
+ (all `pub unsafe fn` with no callers). No `unsafe fn` remains in the public
55
+ API.
56
+ - Two no-op `std::mem::transmute` calls on `&[u32]` slices.
57
+
58
+ ## [1.0.0]
59
+
60
+ - First release: dense canonical labeling, automorphism group generators,
61
+ orbits via the Schreier–Sims chain, vertex-coloured canonicalization,
62
+ digraphs, graph6 I/O, and the `canonaut` Python bindings.
@@ -0,0 +1,44 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use canonaut in academic work, please cite the SoftwareX article below."
3
+ title: "canonaut: A Safe Rust Implementation of the nauty Graph Canonicalization Algorithm"
4
+ abstract: >-
5
+ canonaut is a native, memory-safe Rust implementation of the nauty graph
6
+ canonicalization and automorphism-group algorithm, with graph6 I/O,
7
+ vertex-colored canonicalization, digraph support, and Python bindings
8
+ distributed under the same name.
9
+ type: software
10
+ version: 1.0.0
11
+ license: Apache-2.0
12
+ repository-code: "https://github.com/um-univie/canonaut"
13
+ url: "https://docs.rs/canonaut"
14
+ keywords:
15
+ - graph canonicalization
16
+ - automorphism group
17
+ - graph isomorphism
18
+ - nauty
19
+ - Rust
20
+ authors:
21
+ - family-names: Uhlir
22
+ given-names: Manuel
23
+ email: manuel.uhlir@univie.ac.at
24
+ orcid: "https://orcid.org/0009-0002-7720-2316"
25
+ affiliation: "Institute of Theoretical Chemistry, University of Vienna"
26
+ - family-names: Flamm
27
+ given-names: Christoph
28
+ email: christoph.flamm@univie.ac.at
29
+ orcid: "https://orcid.org/0000-0001-5500-2415"
30
+ affiliation: "Institute of Theoretical Chemistry, University of Vienna"
31
+ references:
32
+ - type: article
33
+ title: "Practical graph isomorphism, II"
34
+ authors:
35
+ - family-names: McKay
36
+ given-names: "Brendan D."
37
+ - family-names: Piperno
38
+ given-names: Adolfo
39
+ journal: "Journal of Symbolic Computation"
40
+ volume: 60
41
+ start: 94
42
+ end: 112
43
+ year: 2014
44
+ doi: 10.1016/j.jsc.2013.09.003
@@ -0,0 +1,55 @@
1
+ # Contributing to canonaut
2
+
3
+ Bug reports, reproducers, and patches are welcome. `canonaut` is a port of
4
+ nauty, so the bar for changes in the search core is deliberately high: the
5
+ canonical form a given graph receives is an API contract (it must stay
6
+ byte-identical to C nauty's), and the algorithm mirrors nauty's control flow so
7
+ the two can be diffed against each other.
8
+
9
+ ## Getting set up
10
+
11
+ ```sh
12
+ ./setup.sh # Rust toolchain, nauty, a Python venv with
13
+ # pynauty/networkx, regenerated test_data/, tests
14
+ ./setup.sh --skip-testdata # just build and run the tests
15
+ ```
16
+
17
+ ## Before opening a pull request
18
+
19
+ ```sh
20
+ cargo test # 105 tests, incl. the committed smoke corpus
21
+ cargo test -- --include-ignored # + the full pynauty cross-validation
22
+ cargo clippy --all-targets -- -D warnings
23
+ ```
24
+
25
+ Changes to the search, refinement, or bitset routines should also be checked
26
+ under Miri, which is what the CI job runs:
27
+
28
+ ```sh
29
+ MIRIFLAGS=-Zmiri-disable-isolation cargo +nightly miri test --lib -- \
30
+ --skip g6 --skip large --skip smoke --skip fuzz \
31
+ --skip hard_instances --skip test_graphs --skip test_random --skip test_known
32
+ ```
33
+
34
+ If a change can affect performance, report before/after numbers from
35
+ `cargo bench --features c-nauty-bench` (see `repro/README.md`).
36
+
37
+ ## Ground rules for the core
38
+
39
+ - **Canonical forms may not change.** `test_data/smoke/` and the full corpora
40
+ compare canonaut's output byte-for-byte against pynauty; any change that
41
+ moves those outputs is a breaking change, not a bug fix.
42
+ - **`unsafe` stays internal and justified.** Every `unsafe` block carries a
43
+ `// SAFETY:` comment stating the invariant that makes it sound. The public
44
+ API contains no `unsafe fn`; keep it that way.
45
+ - **No allocation in the steady state.** `CanonautManager` owns its buffers and
46
+ reuses them; `src/bin/memcheck` reports steady-state allocation counts and
47
+ they should stay at zero.
48
+ - **Naming.** Identifiers are spelled out (`words_per_vertex`, not `m`) even
49
+ where nauty abbreviates; a comment naming the nauty counterpart is welcome.
50
+
51
+ ## Reporting a bug
52
+
53
+ A report is most useful with the graph that triggers it in graph6 form, the
54
+ `CanonautManager` configuration used, and what C nauty (or pynauty) returns for
55
+ the same input.