Cirq has two in-built realizations of quantum hardware, which are realized as GridQubit() and LineQubit() classes (naming convention is slightly disturbing:).

GridQubit device mimics connectivity of Google's quantum chips (Bristlecone, Sycamore) and qubits are arranged in a 2D grid with nearest-neighbor couplings. https://github.com/quantumlib/Cirq/blob/master/cirq/devices/grid_qubit.py

LineQubit device represents chips with 1D geometry, where qubits are arranged in a line and again only nearest-neighbor qubits are coupled.

Is there any possibility to specify a custom hardware coupling map? E.g. to specify adjacency matrix of new connectivity graph?

It seems that a user has to create his/her own device class for such functionality.


1 Answer 1


Generally, yes, it is expected that you would define your own device and perhaps your own qubits in order to make custom topologies.

There is currently a graph device package in the "contrib" package, which allows you to specify the connectivity graph for a device. But as with anything in contrib it may be a bit clunky and could disappear/change from version to version.

import cirq.contrib.graph_device

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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