StochasticSwap

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

Map a DAGCircuit onto a coupling_map adding swap gates.

Uses a randomized algorithm.

Notes

  1. Measurements may occur and be followed by swaps that result in repeated measurement of the same qubit. Near-term experiments cannot implement these circuits, so some care is required when using this mapper with experimental backend targets.

  2. We do not use the fact that the input state is zero to simplify the circuit.

StochasticSwap initializer.

The coupling map is a connected graph

If these are not satisfied, the behavior is undefined.

Parameters
  • coupling_map (CouplingMap) – Directed graph representing a coupling map.

  • trials (int) – maximum number of iterations to attempt

  • seed (int) – seed for random number generator

Attributes

StochasticSwap.is_analysis_pass

Check if the pass is an analysis pass.

StochasticSwap.is_transformation_pass

Check if the pass is a transformation pass.

Methods

StochasticSwap.name()

Return the name of the pass.

StochasticSwap.run(dag)

Run the StochasticSwap pass on dag.