@@ -388,6 +388,11 @@ def _build_generic_target(self):
388
388
defaults = self ._generate_calibration_defaults ()
389
389
calibration_inst_map = defaults .instruction_schedule_map
390
390
391
+ is_fully_connected = (
392
+ self ._coupling_map .graph .num_edges ()
393
+ == self ._coupling_map .graph .num_nodes () * (self ._coupling_map .graph .num_nodes () - 1 )
394
+ )
395
+
391
396
# Iterate over gates, generate noise params from defaults,
392
397
# and add instructions, noise and calibrations to target.
393
398
for name in self ._basis_gates :
@@ -406,9 +411,12 @@ def _build_generic_target(self):
406
411
noise_params = self ._get_noise_defaults (name , gate .num_qubits )
407
412
self ._add_noisy_instruction_to_target (gate , noise_params , calibration_inst_map )
408
413
else :
409
- qarg_set = self ._coupling_map if gate .num_qubits > 1 else range (self .num_qubits )
410
- props = {(qarg ,) if isinstance (qarg , int ) else qarg : None for qarg in qarg_set }
411
- self ._target .add_instruction (gate , properties = props , name = name )
414
+ if is_fully_connected :
415
+ self ._target .add_instruction (gate , properties = None , name = name )
416
+ else :
417
+ qarg_set = self ._coupling_map if gate .num_qubits > 1 else range (self .num_qubits )
418
+ props = {(qarg ,) if isinstance (qarg , int ) else qarg : None for qarg in qarg_set }
419
+ self ._target .add_instruction (gate , properties = props , name = name )
412
420
413
421
if self ._control_flow :
414
422
self ._target .add_instruction (IfElseOp , name = "if_else" )
0 commit comments