I trying to do some tests in the IBM Q5 computer of IBM quantm experience for some simple error correction protocols, but as I can see, some operations between the qubits are not allowed.

For example, it is not possible to perform a CNOT operation with the fourth qubit or when selecting one for as the target qubit for the operation, it does not allow to use any of the other qubits as control qubits.

I have been thinking about the fact that maybe it is because of the physical implementation of such computer, but as I do not know much about the construction of quantum computers I do not know if that might be the cause. So I am wondering if that is actually the issue, or otherwise why those operations are not allowed.


2 Answers 2


Yes, the physical implementation is the constraint. If you look at the image of the processor you'll notice the connections between qubits. This gives you an idea of how you can perform two qubit gates between particular qubits.

Here's the documentation on the Tenerife backend. In the section titled Two Qubit gates at the bottom you can read the details. Also the directions of the gates are also detailed in a log file there.


Image taken from Tenerife documention


The five qubit IBM devices have a ‘bow tie’ architecture, which mean that it is only possible to interact certain pairs of qubits. These are shown in the answer of Andrew O.

The interaction that can be performed between these pairs of qubits is a CNOT with a particular direction. However, it is possible to implement others indirectly.

For example, to perform a CNOT with q0 as control and q1 as target, use

h q[0];
h q[1];
cx q[1], q[0];
h q[1];
h q[0];

The above can be added in the QASM editor. Or you could do the same with the GUI: it is a CNOT with Hadamads before and after on both qubits. The Hadamards effectively reverse the CNOT direction.

  • 1
    $\begingroup$ Good catch. I forgot to mention you can reverse the direction to the cnot with hadamards. $\endgroup$
    – Andrew O
    Commented May 30, 2018 at 17:20
  • $\begingroup$ Thanks for the usefull equivalence using Hadamard gates. Anyway, and due to the fact that quantum gates introduce errors in qubits, would not that equivalent circuit be more prone to suffer from errors? $\endgroup$ Commented May 31, 2018 at 7:56
  • $\begingroup$ Single qubit gates are pretty clean, so it shouldn't suffer too much. CNOTs between qubits that are not connected could also be created using SWAP gates, but these would introduce a lot of error so it's not recommended. $\endgroup$ Commented May 31, 2018 at 8:47
  • $\begingroup$ I am afraid does your solution works now? I tried and it gives not possible in this toplogy (ibmqx4) $\endgroup$ Commented Oct 24, 2018 at 4:22

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.