I'm studying the qubit mapping algorithm called SABRE. SABRE is an algorithm for solving qubit mapping problem effectively. It uses multiple SWAP gates to execute quantum circuit on real quantum device by mapping virtual qubits to physical qubits. Since each quantum devices has its own coupling graph (Connection of physical qubits), SABRE algorithm consider it and add additional SWAP gates to make quantum circuit executable on quantum device. If you want to see more detail about it you can see this paper. https://arxiv.org/abs/1809.02573

From now, I will tell you my problem. I can access the SABRE algorithm by using qiskit. https://qiskit.org/documentation/stubs/qiskit.transpiler.passes.SabreSwap.html

I use qiskit transpiler to use SABRE and I know transpiler use random seed for each execution that makes every results not to be same.

Then how to check if the SABRE algorithm is right or wrong?

Is there any way to check SABRE algorithm's correctness?

I really wonder about this issue. Please kindly check my question and reply.

  • $\begingroup$ By "if the SABRE is right or wrong?" what do you mean by "right" and "wrong"? That the circuits are equivalent up to some SWAPs just before measurement? Same question about your usage of "correctness". $\endgroup$ Jun 24, 2021 at 11:14
  • $\begingroup$ I mean when we execute quantum circuit on the real quantum device, we must consider about coupling graph of it. So, after mapping virtual qubit to physical qubit (after qubit mapping process), we measure it. But, if the result is not same with original quantum circuit result, that means qubit mapping process has something problem. So, I wonder SABRE is right. $\endgroup$
    – 김동민
    Jun 24, 2021 at 12:15
  • $\begingroup$ Correctness also means, we need to check if the SABRE returns same result. I think both results from measuring quantum circuit with qubit mapping and without qubit mapping should be same. But what if they are different? If they are different, qubit mapping process has problem. Isn't it? $\endgroup$
    – 김동민
    Jun 24, 2021 at 12:18

1 Answer 1


You can seed the transpiler with the parameter seed_transpiler to obtain the same map in every execution.

transpile(circuit, backend, seed_transpiler=21, routing_method='sabre')

About checking SABRE (the word correctness has a meaning in computer science that, I assume, is not the one you are trying to convey), the pass CheckMap checks if all the two-qubits interactions are between connected qubits in the coupling map. The transpiler runs that pass after the routing method.

  • $\begingroup$ I already use seed_tranpiler parameter when I transpile my quantum circuit. Using that parameter makes the result same for every execution. But what I really want to know is, how to check SABRE's correctness. Two results from executing SABRE (qubit mapping) and without SABRE should be same. But what if they are different? I think it means the SABER algorithm is not accurate. What do you think about this? $\endgroup$
    – 김동민
    Jun 24, 2021 at 12:22
  • $\begingroup$ what you mean by "the same"? These two execution are concrete executions or do you want to probe that for "any pair of possible executions"? $\endgroup$
    – luciano
    Jun 24, 2021 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.