From 53d54c3a3648288e40d3ae21e76206f88cb7b981 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 3 Nov 2021 10:31:32 -0400 Subject: [PATCH] Use id_order=True on vf2_mapping() for VF2Layout pass Using id_order=False orders the nodes by degree which biases the mapping found by vf2 towards nodes with higher connectivity which typically have higher error rates. Until the pass is made noise aware to counter this bias we should just use id_order=True which uses the node id for the order (which roughly matches insertion order) which won't have this bias in the results. --- qiskit/transpiler/passes/layout/vf2_layout.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qiskit/transpiler/passes/layout/vf2_layout.py b/qiskit/transpiler/passes/layout/vf2_layout.py index d9ac7b48ba4c..4b7a15f0a274 100644 --- a/qiskit/transpiler/passes/layout/vf2_layout.py +++ b/qiskit/transpiler/passes/layout/vf2_layout.py @@ -30,7 +30,7 @@ class VF2LayoutStopReason(Enum): class VF2Layout(AnalysisPass): """A pass for choosing a Layout of a circuit onto a Coupling graph, as a - a subgraph isomorphism problem, solved by VF2++. + a subgraph isomorphism problem, solved by VF2. If a solution is found that means there is a "perfect layout" and that no further swap mapping or routing is needed. If a solution is found the layout @@ -93,7 +93,12 @@ def run(self, dag): im_graph.add_nodes_from(range(len(qubits))) im_graph.add_edges_from_no_data(interactions) - mappings = vf2_mapping(cm_graph, im_graph, subgraph=True, id_order=False, induced=False) + # id_order=True is set here to not use the VF2++ heuristic. VF2++ + # searches over node in order of degree and thus has a bias towards + # picking nodes with more connectivity which typically have higher + # noise which means with id_order=False we would have a bias towards + # picking qubits with typically higher noise. + mappings = vf2_mapping(cm_graph, im_graph, subgraph=True, id_order=True, induced=False) try: mapping = next(mappings) stop_reason = VF2LayoutStopReason.SOLUTION_FOUND