route_circuit works out where and when each operation happens on the surface-code
lattice.
What routing produces
The plan lives on a 3-D lattice:- the two spatial axes are the grid of surface-code patches — your logical qubits and the free space they use to interact;
- the third axis is time, measured in error-correction cycles.
TopologicalProgram — a complete, cycle-by-cycle layout of the circuit on
the lattice, together with summary statistics. Its size (how many patches, over how many
cycles) is the real cost of running the circuit fault-tolerantly, and it’s what the later
stages visualize and turn into an error estimate. Finding a good layout is a hard
combinatorial problem; the engine solves it pragmatically to scale to circuits well beyond
what hand-routing allows.
Routing a circuit
Routing expects a transpiled Clifford+T circuit — the gate set surface codes implement natively. Build and synthesize a model as usual, thenexport it to OpenQASM with a
FaultTolerantTranspilationConfig so the circuit is decomposed into Clifford+T, and pass the
resulting QASM to route_circuit:
program is a TopologicalProgram. Next, you can
visualize it or
estimate its total error.