2
$\begingroup$

When creating a coupling map the parameters can be left empty, but what type of coupling map does this create. In the Qiskit documentation it says

By default, the generated coupling has no nodes.

But I don't quite understand what this means. What is a coupling map without nodes? I obviously presume that it uses a fully connected coupling map, but I can't seem to find a straight answer to this question.

$\endgroup$
1
  • $\begingroup$ If I simply run CouplingMap().draw() it really is an empty, $\endgroup$ Dec 4 '21 at 11:09
1
$\begingroup$

The CouplingMap class is used to model the connectivity constraints of a backend for Qiskit's compiler. The compiler uses it to know what the limitations are on connectivity when mapping a circuit to a given backend and optimizing it for that backend. It is basically just a directed graph where the nodes are the qubits and the edges represent 2q gate connectivity between qubits. The class can be used to model any connectivity constraints on a QPU. If you create an empty graph with no nodes that's modeling a backend without any qubits (i.e. no nodes) which while valid is not particularly useful as it could only run an empty quantum circuit.

The main reason the constructor by default (with no arguments specified) creates an empty graph is to enable dynamically create the graph after creation. For example, if you wanted to create a new linear coupling graph by adding edges after it's created you could do something like:

from qiskit.transpiler import CouplingMap
cmap = CouplingMap()
for i in range(4):
    cmap.add_edge(i, i + 1)

which is equivalent of doing cmap = CouplingMap([(0, 1), (1, 2), (2, 3), (3, 4)]) but there could be use cases where you need to add edges or nodes to the graph after it's initial creation.

$\endgroup$
0
$\begingroup$

If we run CouplingMap().draw() it'll actually draw just an empty coupling map. This makes sense, because if it drew a fully connected coupling map, how would it know how many qubits to use. And if a job receives no coupling map it'll use the default coupling map of the backend it is being ran on.

$\endgroup$
1
  • $\begingroup$ This is not an answer, please consider a comment for such posts. $\endgroup$ Jan 9 at 21:45

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.