0
$\begingroup$

When using with_layout=True as argument in qc.draw() where qc is a QuantumCircuit object the resulting text includes the mapping from the qubits in the circuit to the physical qubits like this:

ancilla_0 -> 0 ----
q_3 -> 1 ----
q_2 -> 2 ----   ...
q_0 -> 3 ----
meas: 3/====

Which one (q_3 or 1 eg.) is the qubit in the circuit and which one the physical qubit?

Note: I assume the answer can be found at wire_names() of TextDrawing(qiskit/visualization/text.py lines 782 to 789 in version 0.36.2), but I'm not sure if I understand it correctly.

        for reg in self.qubits:
            register = self.bit_locations[reg]["register"]
            index = self.bit_locations[reg]["index"]
            qubit_label = get_bit_label("text", register, index, qubit=True, layout=self.layout)
            qubit_label += ": " if self.layout is None else " "
            qubit_labels.append(qubit_label + initial_qubit_value)```
$\endgroup$

1 Answer 1

1
$\begingroup$

$a \rightarrow b$ means the virtual qubit $a$ is mapped to the physical qubit $b$. You can easily check that by visualizing the layout of the transpiled circuit using plot_circuit_layout function.

Draw the virtual view:

plot_circuit_layout(transpiled_circ, backend = backend, view = 'virtual')

Draw the physical view:

plot_circuit_layout(transpiled_circ, backend = backend, view = 'physical')

Now, compare both views with the layout information in your circuit plot.

$\endgroup$

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.