The algebra of entanglement and the geometry of composition

String diagrams turn algebraic equations into topological moves. These moves have often-recurring shapes, involving the sliding of one diagram past another. In the past, this fact has mostly been considered in terms of its computational convenience; this thesis investigates its deeper reasons. In the first part of the thesis, we individuate, at its root, the dual nature of polygraphs — freely generated higher categories — as presentations of higher algebraic theories, and as combinatorial descriptions of “directed spaces”: CW complexes whose cells have their boundary subdivided into an input and an output region. Operations of polygraphs modelled on operations of topological spaces, including an asymmetric tensor product refining the topological product of spaces, can then be used as the foundation of a compositional universal algebra, where sliding moves of string diagrams for an algebraic theory arise from tensor products of sub-theories. Such compositions come automatically with higher-dimensional coherence cells. We provide several examples of compositional reconstructions of higher algebraic theories, including theories of braids, homomorphisms of algebras, and distributive laws of monads, from operations on polygraphs. In this regard, the standard formalism of polygraphs, based on strict ω-categories, suffers from some technical problems and inadequacies, including the difficulty of computing tensor products. As a solution, we propose a notion of regular polygraph, barring cell boundaries that are degenerate, that is, not homeomorphic to a disk of the appropriate dimension. We develop the theory of globular posets, based on ideas of poset topology, in order to specify a category of shapes for cells of regular polygraphs. We prove that these shapes satisfy our non-degeneracy requirement, and show how to calculate their tensor products. Then, we introduce a notion of weak unit for regular polygraphs, allowing us to recover weakly degenerate boundaries in low dimensions. We prove that the existence of weak units is equivalent to the existence of cells satisfying certain divisibility properties — an elementary notion of equivalence cell — which prompts new questions on the relation between units and equivalences in higher categories. In the second part of the thesis, we turn to specific applications of diagrammatic algebra to quantum theory. First, we re-evaluate certain aspects of quantum theory from the point of view of categorical universal algebra, which leads us to define a 2-dimensional refinement of the category of Hilbert spaces. Then, we focus on the problem of axiomatising fragments of quantum theory, and present the ZW calculus, the first complete diagrammatic axiomatisation of the theory of qubits. The ZW calculus has specific advantages over its predecessors, the ZX calculi, including the existence of a computationally meaningful normal form, and of a fragment whose diagrams can be interpreted physically as setups of fermionic oscillators. Moreover, the choice of its generators reflects an operational classification of entangled quantum states, which is not well-understood for states of more than 3 qubits: our result opens the way for a compositional understanding of entanglement for generic multipartite states. We conclude with preliminary results on generalisations of the ZW calculus to quantum systems of arbitrary finite dimension, including the definition of a universal set of generators in each dimension.