You are reading without signing in. Sign in or continue as guest to take quizzes and keep XP.
Topology and SWAP cost
Coupling maps, the heavy-hex lattice, and how to lay out a circuit so the router adds nothing.
- Read a coupling map and find the shortest path between two qubits.
- Predict how many SWAPs a non-adjacent CNOT costs.
- Explain why IBM uses heavy-hex instead of a square grid.
A superconducting chip can only apply two-qubit gates between physically coupled pairs. The coupling map is that graph. A CNOT between qubits three hops apart needs two SWAPs to bring them together (six two-qubit gates) plus the CNOT itself. IBM's heavy-hex lattice has degree 2 and 3 only: fewer neighbours than a square grid, chosen to reduce crosstalk and frequency collisions at the price of more routing.
Make the router work
This circuit couples qubit 0 with qubit 4 directly. Compile for fake_manila and read the SWAP count in Metrics; then compare with fake_kyiv or a Heron twin where the layout can pick adjacent physical qubits.
OPENQASM 3.0; include "stdgates.inc"; qubit[5] q; bit[5] c; h q[0]; cx q[0], q[4]; cx q[1], q[3]; c = measure q;
On a line of qubits 0–1–2–3, a CNOT between 0 and 3 needs at least…
Sign in to answer and earn XP; you will come back to this lesson.
Why might a chip deliberately give each qubit fewer neighbours?
Sign in to answer and earn XP; you will come back to this lesson.
Two-qubit gates only run between coupled qubits; every missing edge costs SWAPs. Check the topology map, let the layout stage pick good qubits, and count SWAPs in Metrics.
Up next: Running on IBM Quantum