Circuit Depth Optimization
Depth is the number of time-steps a circuit needs when gates that touch different qubits run in parallel. Compilers reduce it by cancelling gate pairs that undo each other and by packing independent gates into the same layer — but only rewrites that provably leave the output unchanged are allowed.
What does depth actually measure?
A quantum circuit is an ordered list of gates — operations applied to one or two qubits. Two gates that touch completely different qubits can run at the same time. A layer is a set of gates executed simultaneously, and the depth of a circuit is the number of layers it needs. Depth is a schedule length, exactly like the critical path of a project plan: tasks that share no resource go in the same time slot. That analogy is exact for scheduling — it says nothing about quantum behaviour, only about timing.
Worked example. Take five gates in this order: H on q0, X on q1, CX on (q0,q1), H on q0, H on q1. Layer 1 holds H q0 and X q1 (different qubits). Layer 2 holds the CX (it needs both qubits, so it waits). Layer 3 holds the two final H gates. Gate count 5, depth 3.
Now attach times. Suppose a one-qubit gate takes 30 nanoseconds and a two-qubit gate 300 ns — typical for superconducting hardware. Run serially, one gate at a time: 30 + 30 + 300 + 30 + 30 = 420 ns. Run by layers: 30 + 300 + 30 = 360 ns. Same gates, shorter wall-clock time.
Why care about nanoseconds? A qubit holds its quantum state only for a limited window called the coherence time — often tens to hundreds of microseconds on superconducting devices (see hardware metrics). Every layer spends part of that budget, and qubits sitting idle decay too. Shallower circuits finish before the state degrades.
You’ve read the opening of chapter 7 — 6 more sections follow, with worked examples and circuits you can run on the page. A free account unlocks every chapter of every course (paid plans aren’t live yet — early readers get everything free).