# Allowed CNOT gates for IBM Q 5 quantum computer

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.

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.

https://github.com/QISKit/qiskit-backend-information/tree/master/backends/tenerife/V1

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.

• Good catch. I forgot to mention you can reverse the direction to the cnot with hadamards. – Andrew O May 30 '18 at 17:20
• 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? – Josu Etxezarreta Martinez May 31 '18 at 7:56
• 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. – James Wootton May 31 '18 at 8:47
• I am afraid does your solution works now? I tried and it gives not possible in this toplogy (ibmqx4) – bharath muppa Oct 24 '18 at 4:22