#hypergraph #open #tensor #data-parallel #transformation #reverse #optic

open-hypergraphs

Data-Parallel Algorithms for Open Hypergraphs

3 releases

new 0.1.2 Mar 11, 2025
0.1.1 Feb 27, 2025
0.1.0 Feb 27, 2025

#616 in Algorithms

Download history 285/week @ 2025-02-27

285 downloads per month

MIT license

105KB
2K SLoC

Open Hypergraphs

An implementation of Data Parallel Algorithms for String Diagrams. See also the Python implementation.

Features:

  • Algebraic construction by tensor and composition
  • Functors, including optic transformation for reverse differentiation of morphisms
  • Data-parallel diagram layering

lib.rs:

Open Hypergraphs

A library for representing the two-dimensional syntax of string diagrams. Use it if you think of your data in terms of "boxes and wires" like this:

          ┌───┐
      ────│ f │────┐    ┌───┐
          └───┘    └────│   │
                        │ h │────
          ┌───┐    ┌────│   │
      ────│ g │────┘    └───┘
          └───┘

A concrete example: neural networks, where wires carry tensors (e.g. a 3×4 matrix) and boxes are tensor operations (e.g. matmul)

Dependencies

~150KB