Category-theoretic graph structures in Rust. The catgraph crate (v0.13.0) is a strict Rust implementation of Fong & Spivak, Hypergraph Categories (2019). Applied-CT extensions (catgraph-applied v0.6.0) track Fong & Spivak, Seven Sketches in Compositionality (2018). Wolfram-physics extensions live in a third workspace crate (catgraph-physics v0.3.0). Magnitude of enriched categories + magnitude homology (catgraph-magnitude v0.5.0) is anchored to Bradley & Vigneaux (2025), Leinster–Shulman, Magnitude homology of enriched categories and metric spaces (2017), and Leinster, The Euler characteristic of a category (2008). Categorical Deep Learning substrate (catgraph-dl v0.4.1) is anchored to Gavranović et al., Categorical Deep Learning is an Algebraic Theory of All Architectures (ICML 2024).
| Crate | Path | Purpose |
|---|---|---|
catgraph v0.13.0 |
catgraph/ |
Strict Fong-Spivak 2019 paper implementation: cospans, spans, Frobenius algebras, hypergraph categories, Theorem 1.2 equivalence, spider theorem (Thm 6.55), Corel<Λ> (F&S 2018 Ex 6.64). parallel feature (rayon, WASM-compatible). rustworkx feature flag (default-on) for slim builds. |
catgraph-physics v0.3.0 |
catgraph-physics/ |
Wolfram-physics extensions: hypergraph DPO rewriting, multiway evolution, gauge theory, branchial spectral analysis. |
catgraph-applied v0.6.0 |
catgraph-applied/ |
Applied CT extensions. Tier 1: generic DecoratedCospan<F> (Def 6.75, Thm 6.77), Petri nets, wiring diagrams, E_n operads, Temperley-Lieb, linear combinations. Tier 2: Prop + Free(G) (Def 5.2, 5.25), OperadAlgebra with CircAlgebra (Def 6.99, Ex 6.100), OperadFunctor with canonical E₁↪E₂. Tier 3: Rig trait + 4 concrete rigs (Def 5.36), SignalFlowGraph<R> (Def 5.45), MatR<R> (Def 5.50), sfg_to_mat functor (Thm 5.53), Presentation<G> with CC decision engine + Layer-1 Joyal-Street NF, EnrichedCategory<V> + LawvereMetricSpace<T>, CompleteFunctor<G> + MatrixNFFunctor<R> closing Thm 5.60 semantically. v0.6.0: Integer → ZAlgebra trait rename (Bourbaki Algèbre Ch. II §1 ring-homomorphism ℤ → R term-of-art) + private::Sealed supertrait. |
catgraph-magnitude v0.5.0 |
catgraph-magnitude/ |
Magnitude of enriched categories + magnitude homology. v0.1.x: Tsallis q-entropy + Shannon recovery + Möbius inversion + LmCategory + WeightedCospan<Λ, Q>. v0.2.x: weighting / coweighting (Leinster 2013 Def 1.1.1) + is_scattered + mobius_function_via_chains (von-Neumann series). v0.3.0: chain_complex over LawvereMetricSpace, integer SNF via Storjohann §7.12 + 2-prime rank recovery, magnitude_homology_rank<Q> (BV 2025 Prop 3.14), euler_char_identity_at analytical-bound acceptance suite. v0.4.0: mobius_function_via_chains_exact (Leinster 2008 Cor 1.5 integer-exact Möbius), multi-prime CRT SNF lift (Newman 1972 §1.4 Thm II.9 chain rebalance), PosetCategory input type. v0.5.0: ZAlgebra consumer-side rename + closed-form Möbius cross-check fixture + bidirectional verify_mobius_recursion harness. |
catgraph-dl v0.4.1 |
catgraph-dl/ |
Categorical Deep Learning substrate. Para(M, C) 2-category over (Set, ×, 1) (CDL §3.1) + MonoidalCategory / Actegory<M> / Comonoid<M> traits + DiagonalComonoid weight tying (CDL Theorem G.10) + tie_weights consumer API. F-algebras / coalgebras with verify_commutes (CDL Defs 2.3, 2.8, B.2) + Z2 group-action GDL recovery test (CDL Example 2.6). Recursive FreeMnd<F, Z> / CofreeCmnd<F, Z> via GAT projection + ListEndo<A> / TreeEndo<A> bijections (CDL Prop B.18 / Examples B.19, B.20). Five architecture unrollers — FoldingRnn, RecursiveNn, UnfoldingRnn, MealyCell, MooreCell — with FreeMnd-equivalence tests (CDL Remark 2.13). v0.4.0: tie_weights actegory-genericity (C: Actegory<SetMonoidal>), SetCategoryDefaults soft-seal via private::Sealed. |
These are separate repos that depend on workspace crates via git-tagged pins:
| Repo | Purpose |
|---|---|
| catgraph-surreal | SurrealDB persistence layer for catgraph and catgraph-physics types (v0.11.1) |
| irreducible | Computational irreducibility framework (Gorard 2023) using catgraph and catgraph-physics (v0.6.5) |
Sibling repos pin to a single workspace umbrella tag (not each crate's individual version tag) for cargo source-identity deduplication. Multi-tag-string pinning to the same git URL produces multiple cargo source identities → path-dep-shared catgraph crates compile multiple times → boundary-type trait mismatches. Single-tag pinning deduplicates.
| Umbrella tag | Crate versions |
|---|---|
v0.12.2 |
catgraph v0.12.2 + catgraph-applied v0.5.4 + catgraph-magnitude v0.1.1 |
v0.13.0 |
adds catgraph-dl v0.2.0 |
v0.13.1 |
catgraph-dl v0.3.0 |
v0.13.2 |
catgraph-dl v0.3.1 |
v0.13.3 |
catgraph-magnitude v0.3.0 + catgraph-applied v0.5.5 |
v0.13.4 |
catgraph-magnitude v0.3.1 |
v0.13.5 |
catgraph-dl v0.4.0 |
v0.13.6 |
catgraph-dl v0.4.1 |
v0.13.8 |
catgraph-magnitude v0.4.0 + catgraph-applied v0.5.6 + catgraph v0.13.0 |
v0.14.0 (current) |
catgraph-magnitude v0.5.0 + catgraph-applied v0.6.0 |
cargo build --workspace
cargo test --workspace
cargo clippy --workspace -- -W clippy::pedanticEach crate has its own README:
catgraph/README.md— strict F&S 2019 implementationcatgraph-physics/README.md— Wolfram-physics extensionscatgraph-applied/README.md— applied-CT extensionscatgraph-magnitude/README.md— magnitude of enriched categoriescatgraph-dl/README.md— CDL ICML 2024 substrate
MIT — see LICENSE.