# How to check accuracy of SABRE algorithm?

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?

• 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". Jun 24 at 11:14
• 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.
– 김동민
Jun 24 at 12:15
• 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?
– 김동민
Jun 24 at 12:18

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.