Skip to content

Commit

Permalink
Use id_order=True on vf2_mapping() for VF2Layout pass
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mtreinish committed Nov 3, 2021
1 parent 729971f commit 53d54c3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions qiskit/transpiler/passes/layout/vf2_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 53d54c3

Please sign in to comment.