qiskit.transpiler.Target.build_coupling_map¶
- Target.build_coupling_map(two_q_gate=None)[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 contstraint on the target. If you wish to see the constraints of the two qubit operations that have constraints you should use thetwo_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.
- Returns
- The
CouplingMap
object for this target. If there are no connectivity constraints in the target this will return
None
.
- The
- Return type
- 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
.