You are reading without signing in. Sign in or continue as guest to take quizzes and climb the ranks.
Topology and SWAP cost
Coupling maps, the heavy-hex lattice, and how to lay out a circuit so the router adds nothing.
- 01Read a coupling map and find the shortest path between two qubits.
- 02Predict how many SWAPs a non-adjacent CNOT costs.
- 03Explain 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
Qubit 0 talks to all three others. fake_manila's qubits sit on a line, where no qubit has three neighbours, so the router must add a SWAP. Compile for fake_manila and count the two-qubit gates: 6 CNOTs instead of the circuit's 3 (one SWAP costs 3 CNOTs). Then compile for fake_kyiv: its heavy-hex lattice has qubits with three neighbours, so 3 two-qubit gates are enough.
OPENQASM 3.0;
include "stdgates.inc";
qubit[4] q;
bit[4] c;
h q[0];
cx q[0], q[1];
cx q[0], q[2];
cx q[0], q[3];
c = measure q;
2 questions · one try each counts
On a line of qubits 0–1–2–3, a CNOT between 0 and 3 needs at least…
Sign in to answer and climb the ranks; you will come back to this lesson.
Why might a chip deliberately give each qubit fewer neighbours?
Sign in to answer and climb the ranks; you will come back to this lesson.