  String diagrams turn algebraic equations into topological moves that have
recurring shapes, involving the sliding of one diagram past another. We
individuate, at the root of this fact, the dual nature of polygraphs as
presentations of higher algebraic theories, and as combinatorial descriptions
of "directed spaces". Operations of polygraphs modelled on operations of
topological spaces are used as the foundation of a compositional universal
algebra, where sliding moves arise from tensor products of polygraphs. We
reconstruct several higher algebraic theories in this framework.
  In this regard, the standard formalism of polygraphs has some technical
problems. We propose a notion of regular polygraph, barring cell boundaries
that are not homeomorphic to a disk of the appropriate dimension. We define a
category of non-degenerate shapes, and show how to calculate their tensor
products. Then, we introduce a notion of weak unit to recover weakly degenerate
boundaries in low dimensions, and prove that the existence of weak units is
equivalent to a representability property.
  We then turn to applications of diagrammatic algebra to quantum theory. We
re-evaluate the category of Hilbert spaces from the perspective of categorical
universal algebra, which leads to a bicategorical refinement. Then, we focus on
the axiomatics of fragments of quantum theory, and present the ZW calculus, the
first complete diagrammatic axiomatisation of the theory of qubits.
  The ZW calculus has several advantages over ZX calculi, including a
computationally meaningful normal form, and a fragment whose diagrams can be
read as setups of fermionic oscillators. Moreover, its generators reflect an
operational classification of entangled states of 3 qubits. We conclude with
generalisations of the ZW calculus to higher-dimensional systems, including the
definition of a universal set of generators in each dimension.
