Skip to main contentIBM Quantum Documentation

SabrePreLayout

class qiskit.transpiler.passes.SabrePreLayout(*args, **kwargs)

GitHub(opens in a new tab)

Bases: AnalysisPass

Choose a starting layout to use for additional Sabre layout trials.


Property Set Values Written

sabre_starting_layouts (list[Layout])

An optional list of Layout objects to use for additional Sabre layout trials.

SabrePreLayout initializer.

The pass works by augmenting the coupling map with more and more “extra” edges until VF2 succeeds to find a perfect graph isomorphism. More precisely, the augmented coupling map contains edges between nodes that are within a given distance d in the original coupling map, and the value of d is increased until an isomorphism is found.

Intuitively, a better layout involves fewer extra edges. The pass also optionally minimizes the number of extra edges involved in the layout until a local minimum is found. This involves removing extra edges and running VF2 to see if an isomorphism still exists.

param coupling_map

directed graph representing the original coupling map or a target modelling the backend (including its connectivity).

type coupling_map

Union[CouplingMap, Target]

param max_distance

the maximum distance to consider for augmented coupling maps.

type max_distance

int

param error_rate

the error rate to assign to the “extra” edges. A non-zero error rate prioritizes VF2 to choose original edges over extra edges.

type error_rate

float

param max_trials_vf2

specifies the maximum number of VF2 trials. A larger number allows VF2 to explore more layouts, eventually choosing the one with the smallest error rate.

type max_trials_vf2

int

param call_limit_vf2

limits each call to VF2 by bounding the number of VF2 state visits.

type call_limit_vf2

int

param improve_layout

whether to improve the layout by minimizing the number of extra edges involved. This might be time-consuming as this requires additional VF2 calls.

type improve_layout

bool

raises TranspilerError

At runtime, if neither coupling_map or target are provided.


Attributes

is_analysis_pass

Check if the pass is an analysis pass.

If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.

is_transformation_pass

Check if the pass is a transformation pass.

If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).


Methods

execute

execute(passmanager_ir, state, callback=None)

GitHub(opens in a new tab)

Execute optimization task for input Qiskit IR.

Parameters

Returns

Optimized Qiskit IR and state of the workflow.

Return type

tuple(opens in a new tab)[Any(opens in a new tab), qiskit.passmanager.compilation_status.PassManagerState]

name

name()

GitHub(opens in a new tab)

Name of the pass.

Return type

str(opens in a new tab)

run

run(dag)

GitHub(opens in a new tab)

Run the SabrePreLayout pass on dag.

The discovered starting layout is written to the property set value sabre_starting_layouts.

Parameters

dag (DAGCircuit) – DAG to create starting layout for.

update_status

update_status(state, run_state)

GitHub(opens in a new tab)

Update workflow status.

Parameters

  • state (PassManagerState) – Pass manager state to update.
  • run_state (RunState) – Completion status of current task.

Returns

Updated pass manager state.

Return type

PassManagerState

Was this page helpful?
Report a bug or request content on GitHub.