diff --git a/qiskit/transpiler/passes/layout/vf2_layout.py b/qiskit/transpiler/passes/layout/vf2_layout.py index 859bf3076f0f..c5987e8e8bba 100644 --- a/qiskit/transpiler/passes/layout/vf2_layout.py +++ b/qiskit/transpiler/passes/layout/vf2_layout.py @@ -213,15 +213,15 @@ def _score_layout(self, layout): bits = layout.get_physical_bits() score = 0 if self.target is not None and "measure" in self.target: - for bit in bits: - props = self.target["measure"].get((bit,)) - if props is None or props.error is None: - score += ( - self.coupling_map.graph.out_degree(bit) - + self.coupling_map.graph.in_degree(bit) - ) / len(self.coupling_map.graph) - else: - score += props.error + for bit in bits: + props = self.target["measure"].get((bit,)) + if props is None or props.error is None: + score += ( + self.coupling_map.graph.out_degree(bit) + + self.coupling_map.graph.in_degree(bit) + ) / len(self.coupling_map.graph) + else: + score += props.error else: if self.properties is None: # Sum qubit degree for each qubit in chosen layout as really rough estimate of error