A graph built from green Z spiders, red X spiders and Hadamard boxes, with open input and output wires. Each diagram denotes a linear map between qubit spaces, obtained by contracting the tensors of its generators along the wires.
Established definitionMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01
AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.
A ZX diagram with m inputs and n outputs is a finite undirected multigraph whose internal
vertices are generators and which has m input and n output boundary wires. The generators,
with their interpretation[[⋅]] as linear maps (C2)⊗a→(C2)⊗b
for a generator with a incoming and b outgoing wires, are:
where ∣±⟩=(∣0⟩±∣1⟩)/2 and a,b≥0 (an empty tensor power is the
number 1). Zαa,b is the Z spider (drawn green), Xαa,b the X spider
(drawn red), H the Hadamard box, and α the spider's phase; a phase of 0 is omitted.
Plain wires denote the identity, and crossing wires the swap.
The interpretation of a whole diagram is the tensor contraction of its generators along the
internal wires, with the boundary wires left open. Because each spider is symmetric in its inputs
and in its outputs, and because bending a wire (turning an input into an output) is implemented by
the cup ∣00⟩+∣11⟩=[[Z00,2]], the interpretation depends only on the graph,
not on how it is drawn ("only connectivity matters").
Two diagrams are equal when their interpretations are equal; many papers instead work up to a
nonzero scalar factor. The calculus was introduced by Coecke and Duncan;
the textbook is Coecke and Kissinger. The definition uses
Xαa,b=H⊗bZαa,bH⊗a, which follows from H∣0⟩=∣+⟩
and H∣1⟩=∣−⟩.
Holds when
Qubits only; phases α∈R taken modulo 2π.
Diagrams are read as tensor networks, so only connectivity matters, not the drawing.
Claude (AI drafting assistant)Writing, original draft (CRediT roles)
Review history
Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)
Generator interpretations, the cup identity and X = H^b Z H^a re-derived and checked numerically (numpy tensors for several arities); introduction of the calculus and its 'only topology matters' reading compared with Coecke and Duncan, arXiv 0906.4725, Sections 2.1-2.4; Crossref metadata for coecke-duncan-2011 and coecke-kissinger-2017 matched.
Revision history
2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e
Current revision fe860deee456679a. Source file knowledge/records/definition/zx-diagram.md in the content repository (readable there once it is public).