DisCoConnect is a Python toolkit for computing syntactic connectivity properties of hypergraph category string diagrams. It extends the DisCoPy by providing algorithmic support for analysing how morphisms compose in hypergraph categories at the diagrammatic level.
DisCoConnect maps hypergraph string diagrams to metagraph representations, enabling the reuse of established metagraph connectivity algorithms to reason about composition, dominance, and cut structures in categorical diagrams.
DisCoConnect provides algorithms to:
- Identify compositions of morphisms witnessing a given input–output relationship
- Enumerate all distinct morphism compositions between a specified domain and codomain
- Compute dominant sets of objects and morphisms required to preserve connectivity
- Identify minimal cuts (critical morphisms) whose removal breaks diagrammatic connectivity
The package is lightweight, modular, and interoperable with DisCoPy’s frobenius.Hypergraph representation.
Hypergraph categories provide a natural formalism for modelling open, interconnected systems with shared variables and multi‑terminal connections. While DisCoPy supports the construction and evaluation of string diagrams, it currently lacks mechanisms for analysing syntactic connectivity—that is, how morphisms compose to establish or block relationships between inputs and outputs.
DisCoConnect addresses this gap by translating hypergraph category string diagrams into metagraphs and applying metagraph connectivity algorithms. This enables systematic analysis of compositional structure, which is particularly useful in domains such as cybersecurity, information‑flow analysis, and the study of compositional attack paths, but is applicable to any setting employing graphical and categorical reasoning.
DisCoConnect requires Python 3.10+ (required by discopy).
Clone the repository and install locally:
git clone https://github.com/AUCyberLab/DisCoConnect.git
cd DisCoConnect
pip install -e .This installs DisCoConnect (and its pinned dependency discopy==1.2.2) in editable mode, so you can import discoconnect from anywhere.
To run the test suite, also install the dev dependencies:
pip install -r requirements-dev.txt
pytest tests/