This section is only a quick sketch (for now). See Wilson and Zanasi [WZ23] for a more in-depth explanation.
Although our datastructure is called a “Diagram”, it is not about the pictorial representation. Yarrow is not a library for drawing graphs! In fact, the yarrow.diagram datastructure is akin to a graph or a tree.
The theory of how to represent string diagrams as hypergraphs is covered in detail in Bonchi et al. [BGK+16] and Bonchi et al. [BGK+22]. The yarrow library accompanies the paper Wilson and Zanasi [WZ23], which shows how these hypergraphs can be encoded as cospans of bipartite multigraphs. The key benefit of this encoding is to allow for data-parallel algorithms for diagrams.
In terms of category theory, a value of type
AbstractDiagram is a
morphism of the free symmetric monoidal category presented by the signature Σ + Frob,
where Σ is a user-supplied monoidal signature.
Differentiability and Optics
One goal of the yarrow library is to allow for large-scale diagrammatic differentiation for use with the differentiable polynomial circuits described in Wilson and Zanasi [WZ22].
Differentiability features are currently under development. See Wilson and Zanasi [WZ23], Section 10 for details.