Skip to content

Vertex Types

The editor supports eleven vertex types: nine are the generators of ZXW calculus; the remaining two — input and output — are boundary markers that declare the open legs of the diagram. Each type has a fixed shape, colour, and role. Pick a type from the vertex-type menu (Add vertex mode) or change an existing vertex’s type from the property panel.

Type Shape Colour Phase label? Directional? Notes
Z spider circle lime ✅ — The Z generator.
X spider circle rose (red) ✅ — The X generator.
Z box square lime ✅ — Box variant of Z.
X box square rose (red) ✅ — Box variant of X.
H box square yellow — — The Hadamard box.
W node triangle dark slate — ✅ “Copy” generator: one input (top), many outputs (bottom).
And gate square white — ✅ Logical AND; renders an interior ∧ glyph (an SVG, not a font character).
Empty node dotted circle slate outline — — A neutral node for diagrams that don’t commit to a generator.
Dot (black_dot) small circle solid black — — A phaseless Z spider: computes as z_spider(arity, 0), so it carries no phase of its own.
Input dotted circle blue — — Boundary marker: declares one open input leg.
Output dotted circle green — — Boundary marker: declares one open output leg.

The input, output, and empty nodes share the dotted-circle shape and differ only by border colour (blue, green, slate) so they read at a glance. black_dot is the one solid, filled type — a small plain black circle with no border.

For the Z/X spiders and Z/X boxes, the vertex label is not free-form text — it is a phase expression. An empty label means phase 0 (the identity).

Type the expression into the vertex label (double-click the vertex, or use the property panel). Wrap it in dollar signs for KaTeX typesetting: $\pi/2$ renders as π/2 and parses as π/2 radians.

The property panel shows a live preview as you type:

  • Renders — what the label will look like inside the vertex (KaTeX for $...$ / $$...$$, plain text otherwise).
  • Phase — the parsed value in radians, plus a multiple of π in parentheses. If the expression is invalid, a red error message appears.

The parser accepts:

  • Numbers: 0, 1, 3.5
  • π: \pi, π, pi, PI
  • Operators: + - * / (and the Unicode − × ÷)
  • Parentheses: ( )
  • Unary +/−

Examples:

Input Parses to
$\pi/2$ ≈ 1.5708 rad (0.5π)
$\pi$ ≈ 3.1416 rad (1π)
$-\pi/4$ ≈ −0.7854 rad
0 or empty 0 rad (identity)
$(\pi + \pi/2) * 2$ ≈ 9.4248 rad

When a phase label fails to parse during a computation, the vertex is treated as phase 0 and a warning is reported in the result dialog — the computation is not aborted.

For H, W, And, the empty node, Dot, input, and output, the label is decoration only — shown as text (or KaTeX if wrapped in $...$) but never parsed as a phase. Use it for annotations if you like.

The W node and And gate are directional: they have one input at the top (a visible dot) and fan out to many outputs at the bottom. When you draw an edge to a directional vertex it connects to the top handle automatically; edges from a directional vertex leave from the body centre. See Editing Graphs § Directional vertices.

The input and output vertices are not generators — they are boundary markers that declare the open legs of the diagram. They render as small dotted circles (blue for input, green for output) and behave like any other vertex on the canvas, with two rules:

  • Each boundary should connect to at most one other vertex. A boundary of degree 0 dangles as an open leg; a boundary of degree > 1 is rejected when you compute.
  • An edge directly between two boundaries (e.g. input → output) is allowed — it acts as an identity wire: the boundary pair contributes an open input leg and an open output leg.

Boundary vertices determine the shape of the computed tensor: with n inputs and m outputs, the diagram evaluates to a 2^m × 2^n matrix (rows = outputs, columns = inputs). A graph with no boundaries evaluates to a scalar. See Computing Tensors.

Each boundary vertex has an order — a 0-indexed position within its own group (inputs and outputs are ordered independently). The order fixes the axis order of the computed tensor: the boundary with order 0 pins the first row/column, order 1 the second, and so on.

  • Orders are assigned automatically when you create, paste, or import a boundary (each new one lands at the end of its group).
  • Edit the Order field in the property panel to reorder a group — the group is re-stamped sequentially, so there are never gaps or duplicates.
  • Each boundary shows its order as a small number badge on the canvas (blue on inputs, top-left; green on outputs, top-right).

Every vertex has an optional rotation (0–360°), edited from the property panel. Rotation is a visual property: it rotates how the vertex is drawn, but it is not part of the graph’s mathematical content and is ignored by the compute step. Edges that attach to a directional vertex’s top handle follow the rotation, so they stay visually attached as the body spins.

Next: Computing Tensors.