0
$\begingroup$

I have something problem with using qiskit. I searched several qiskit docs to get 'qubit location' or 'variables' that represent qubit.

I searched three documents below.

qiskit.transpiler.passes.layout.sabre_layout
qiskit.transpiler.passes.routing.sabre_swap
qiskit.dagcircuit.DAGCircuit

However, I couldn't get the information about qubit location in these docs. SABRE algorithm use qubit location to switch qubit's location to execute on the real quantum hardware with satisfying its coupling graph. That's why I'm sure that these docs will contain information about qubit location to use them. But I can't find it. Could you help me?

If I need to find out some other docs, please let me know. Thank you.

$\endgroup$
0
$\begingroup$

One way you can find the qubits layout in a particular hardware and along with their layout is as follow:

provider = IBMQ.load_account()
backend = provider.get_backend('ibmq_lima')
from qiskit.transpiler import CouplingMap
num_qubits = backend.configuration().n_qubits 
qubit_layout = CouplingMap( getattr(backend.configuration(), 'coupling_map', None) ).reduce([i for i in range(num_qubits)])
print('\n qubit_layout: \n', qubit_layout) 
qubit_layout.draw()  #This will print out the graph at the bottom 

You will get a printout of the qubit coupling map, which is how the qubits are connected together. This then can be use to reconstruct the layout or position of the qubit as you see at the graph at the bottom.

qubit_layout: 
 [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]]

enter image description here

  • You can potentially run into an error when execute qubit_layout.draw() in your own local machine. If this is the case you can test this script through the Jupyter notebook within the IBM Quantum lab.
$\endgroup$
1
  • $\begingroup$ Thank you for your opinion. However the real thing I wanna know it not kind like this. I wanna know the variables that can manipulate qubit location. $\endgroup$
    – 김동민
    Aug 24 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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