Circuit Depth
Gate count tells you how much work a circuit does. Depth counts the layers of gates that must run one after another. Two circuits with the same gates can have different depths. On real machines, more layers means more time for errors to creep in.
What is the difference between gate count and depth?
Two numbers sum up a circuit's size. They answer different questions.
Gate count is the total number of steps. It tells you how much work the circuit holds.
Depth is about time. Gates that touch totally different qubits can run at the same moment. A group of such gates forms one layer. Depth is the number of layers when every gate is packed in as early as it can go.
When can a gate go early? A gate has to wait for another only when they share a qubit. That is exactly the order promise a circuit diagram makes.
Think of cooking dinner. Gate count is the number of tasks on your to-do list. Depth is how long dinner takes if you do tasks side by side whenever you can. Boiling pasta and chopping salad can overlap. Draining the pasta has to wait for the boiling. The example stops working in one way: in a kitchen, one cook can only do so much at once. On a chip, every qubit can be busy in the same layer.
- Worked example: how do I count the layers?
- Run circuit A (depth 2)INTERACTIVE
- Compare circuit B (depth 3)INTERACTIVE
- Worked example: why does depth cost me on real machines?
- Try this: what if I pile both H gates on one wire?INTERACTIVE
- What changes on real hardware?
- What is a barrier, and what should I remember?
You’ve read the opening of chapter 7. Pro unlocks the other 7 sections — plus every chapter of every course, with circuits you can run right on the page. That’s $11.99 a month, about the price of a coffee, or $99.99 a year (save 30%). The first chapter of every course, and the whole math course, stay free.