73 lines
5.0 KiB
Plaintext
73 lines
5.0 KiB
Plaintext
---
|
||
title: VF2PostLayout
|
||
description: API reference for qiskit.transpiler.passes.VF2PostLayout
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.transpiler.passes.VF2PostLayout
|
||
---
|
||
|
||
# VF2PostLayout
|
||
|
||
<Class id="qiskit.transpiler.passes.VF2PostLayout" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.21/qiskit/transpiler/passes/layout/vf2_post_layout.py" signature="VF2PostLayout(*args, **kwargs)" modifiers="class">
|
||
Bases: [`qiskit.transpiler.basepasses.AnalysisPass`](qiskit.transpiler.AnalysisPass "qiskit.transpiler.basepasses.AnalysisPass")
|
||
|
||
A pass for choosing a Layout after transpilation of a circuit onto a Coupling graph, as a subgraph isomorphism problem, solved by VF2++.
|
||
|
||
Unlike the [`VF2PostLayout`](#qiskit.transpiler.passes.VF2PostLayout "qiskit.transpiler.passes.VF2PostLayout") transpiler pass which is designed to find an initial layout for a circuit early in the transpilation pipeline this transpiler pass is designed to try and find a better layout after transpilation is complete. The initial layout phase of the transpiler doesn’t have as much information available as we do after transpilation. This pass is designed to be paired in a similar pipeline as the layout passes. This pass will strip any idle wires from the circuit, use VF2 to find a subgraph in the coupling graph for the circuit to run on with better fidelity and then update the circuit layout to use the new qubits.
|
||
|
||
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 will be set in the property set as `property_set['layout']`. However, if no solution is found, no `property_set['layout']` is set. The stopping reason is set in `property_set['VF2PostLayout_stop_reason']` in all the cases and will be one of the values enumerated in `VF2PostLayoutStopReason` which has the following values:
|
||
|
||
> * `"solution found"`: If a perfect layout was found.
|
||
> * `"nonexistent solution"`: If no perfect layout was found.
|
||
> * `">2q gates in basis"`: If VF2PostLayout can’t work with basis
|
||
|
||
Initialize a `VF2PostLayout` pass instance
|
||
|
||
**Parameters**
|
||
|
||
* **target** ([*Target*](qiskit.transpiler.Target "qiskit.transpiler.Target")) – A target representing the backend device to run `VF2PostLayout` on. If specified it will supersede a set value for `properties` and `coupling_map`.
|
||
* **coupling\_map** ([*CouplingMap*](qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap")) – Directed graph representing a coupling map.
|
||
* **properties** ([*BackendProperties*](qiskit.providers.models.BackendProperties "qiskit.providers.models.BackendProperties")) – The backend properties for the backend. If [`readout_error()`](qiskit.providers.models.BackendProperties#readout_error "qiskit.providers.models.BackendProperties.readout_error") is available it is used to score the layout.
|
||
* **seed** (*int*) – Sets the seed of the PRNG. -1 Means no node shuffling.
|
||
* **call\_limit** (*int*) – The number of state visits to attempt in each execution of VF2.
|
||
* **time\_limit** (*float*) – The total time limit in seconds to run `VF2PostLayout`
|
||
* **strict\_direction** (*bool*) – Whether the pass is configured to follow the strict direction in the coupling graph. If this is set to false, the pass will treat any edge in the coupling graph as a weak edge and the interaction graph will be undirected. For the purposes of evaluating layouts the avg error rate for each qubit and 2q link will be used. This enables the pass to be run prior to basis translation and work with any 1q and 2q operations. However, if `strict_direction=True` the pass expects the input [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") object to [`run()`](qiskit.transpiler.passes.VF2PostLayout#run "qiskit.transpiler.passes.VF2PostLayout.run") to be in the target set of instructions.
|
||
|
||
**Raises**
|
||
|
||
**TypeError** – At runtime, if neither `coupling_map` or `target` are provided.
|
||
|
||
## Methods
|
||
|
||
### name
|
||
|
||
<Function id="qiskit.transpiler.passes.VF2PostLayout.name" signature="VF2PostLayout.name()">
|
||
Return the name of the pass.
|
||
</Function>
|
||
|
||
### run
|
||
|
||
<Function id="qiskit.transpiler.passes.VF2PostLayout.run" signature="VF2PostLayout.run(dag)">
|
||
run the layout method
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### is\_analysis\_pass
|
||
|
||
<Attribute id="qiskit.transpiler.passes.VF2PostLayout.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.
|
||
</Attribute>
|
||
|
||
### is\_transformation\_pass
|
||
|
||
<Attribute id="qiskit.transpiler.passes.VF2PostLayout.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).
|
||
</Attribute>
|
||
</Class>
|
||
|