Tamil
மொழிகள்
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.transpiler.Target.build_coupling_map

Target.build_coupling_map(two_q_gate=None, filter_idle_qubits=False)[source]

Get a CouplingMap from this target.

If there is a mix of two qubit operations that have a connectivity constraint and those that are globally defined this will also return None because the globally connectivity means there is no constraint on the target. If you wish to see the constraints of the two qubit operations that have constraints you should use the two_q_gate argument to limit the output to the gates which have a constraint.

Parameters
  • two_q_gate (str) -- An optional gate name for a two qubit gate in the Target to generate the coupling map for. If specified the output coupling map will only have edges between qubits where this gate is present.

  • filter_idle_qubits (bool) -- If set to True the output CouplingMap will remove any qubits that don't have any operations defined in the target. Note that using this argument will result in an output CouplingMap object which has holes in its indices which might differ from the assumptions of the class. The typical use case of this argument is to be paired with with CouplingMap.connected_components() which will handle the holes as expected.

Returns

The CouplingMap object

for this target. If there are no connectivity constraints in the target this will return None.

Return type

CouplingMap

Raises
  • ValueError -- If a non-two qubit gate is passed in for two_q_gate.

  • IndexError -- If an Instruction not in the Target is passed in for two_q_gate.