A two-qubit gate count is the beginning of a compiler comparison, rather than the explanation of it. Two outputs can have different counts because they use different mappings, different decompositions of the same operation, or different opportunities to simplify adjacent operations.
Inspecting the native gates helps us understand the difference. It also provides a way to check that an apparent improvement represents a useful implementation of the original algorithm.
Follow the logical state through the circuit
Consider three logical qubits a,b,c placed on physical positions 0,1,2. The hardware supports interactions between adjacent positions. An operation on a and c is not adjacent. One possible implementation first swaps positions 0 and 1, performs the requested operation at positions 1 and 2, and keeps the new logical placement for the next operation.
A second operation between a and b now uses positions 1 and 0. It is already local. Restoring the original placement immediately after the first operation would have spent an extra SWAP that the second interaction does not need. The final mapping has to be restored or correctly accounted for in the output interpretation.
Track the input and output placements as well as any required ancillary state.
Illustration: standalone Python calculation.
layout=['a','b','c']
layout[0],layout[1]=layout[1],layout[0]
for a,b in [('a','c'),('a','b')]:
assert abs(layout.index(a)-layout.index(b))==1
print(layout) The example prints:
['b', 'a', 'c'] Gate synthesis can sometimes realize interactions differently, and the cost of a SWAP depends on the target instruction set.
Separate the measurements
Take two valid implementations of the same logical circuit and record the initial and final mappings. Count the native two-qubit gates, identify the longest chain of two-qubit dependencies, and inspect the operations on the physical graph. Look for repeated blocks where the placement at the end of one block affects the next.
Do not infer the number of SWAPs simply by dividing the additional native gate count by a constant. The compiler may merge routing and logical gates during synthesis, so the decomposition can obscure the original movement. Where the compiler provides routing metadata, compare that with the actual output circuit.
Verify the operation as well as the count
For small unitary circuits, compare the resulting operators up to global phase after accounting for logical and physical qubit ordering. For larger circuits use suitable structural checks, selected test states or other verification methods and state their scope. If the experiment contains measurement or classical control, compare the relevant behavior rather than treating the entire circuit as a unitary.
The most informative comparison combines a table of native counts and depths with a diagram of one representative circuit block. Readers can see how the two implementations differ and understand which aspects of the result they might reproduce on their own hardware.
Compile a circuit of your own with the 4colors Quantum Compiler and inspect the resulting native operations and mapping.