class SabreLayout(*args, **kwargs)[source]

Choose a Layout via iterative bidirectional routing of the input circuit.

Starting with a random initial Layout, the algorithm does a full routing of the circuit (via the routing_pass method) to end up with a final_layout. This final_layout is then used as the initial_layout for routing the reverse circuit. The algorithm iterates a number of times until it finds an initial_layout that reduces full routing cost.

This method exploits the reversibility of quantum circuits, and tries to include global circuit information in the choice of initial_layout.


[1] Li, Gushu, Yufei Ding, and Yuan Xie. “Tackling the qubit mapping problem for NISQ-era quantum devices.” ASPLOS 2019. arXiv:1809.02573

SabreLayout initializer.

  • coupling_map (Coupling) – directed graph representing a coupling map.

  • routing_pass (BasePass) – the routing pass to use while iterating.

  • seed (int) – seed for setting a random first trial layout.

  • max_iterations (int) – number of forward-backward iterations.



Check if the pass is an analysis pass.


Check if the pass is a transformation pass.


Return the name of the pass.

Run the SabreLayout pass on dag.