67 lines
3.5 KiB
Plaintext
67 lines
3.5 KiB
Plaintext
---
|
||
title: VF2Layout
|
||
description: API reference for qiskit.transpiler.passes.VF2Layout
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.transpiler.passes.VF2Layout
|
||
---
|
||
|
||
# VF2Layout
|
||
|
||
<Class id="qiskit.transpiler.passes.VF2Layout" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.19/qiskit/transpiler/passes/layout/vf2_layout.py" signature="VF2Layout(*args, **kwargs)" modifiers="class">
|
||
Bases: `qiskit.transpiler.basepasses.AnalysisPass`
|
||
|
||
A pass for choosing a Layout of a circuit onto a Coupling graph, as a 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 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['VF2Layout_stop_reason']` in all the cases and will be one of the values enumerated in `VF2LayoutStopReason` 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 VF2Layout can’t work with basis
|
||
|
||
Initialize a `VF2Layout` pass instance
|
||
|
||
**Parameters**
|
||
|
||
* **coupling\_map** ([*CouplingMap*](qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap")) – Directed graph representing a coupling map.
|
||
* **strict\_direction** (*bool*) – If True, considers the direction of the coupling map. Default is False.
|
||
* **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 `VF2Layout`
|
||
* **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.
|
||
* **max\_trials** (*int*) – The maximum number of trials to run VF2 to find a layout. If this is not specified the number of trials will be limited based on the number of edges in the interaction graph or the coupling graph (whichever is larger). If set to a value \<= 0 no limit on the number of trials will be set.
|
||
|
||
## Methods
|
||
|
||
### name
|
||
|
||
<Function id="qiskit.transpiler.passes.VF2Layout.name" signature="VF2Layout.name()">
|
||
Return the name of the pass.
|
||
</Function>
|
||
|
||
### run
|
||
|
||
<Function id="qiskit.transpiler.passes.VF2Layout.run" signature="VF2Layout.run(dag)">
|
||
run the layout method
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### is\_analysis\_pass
|
||
|
||
<Attribute id="qiskit.transpiler.passes.VF2Layout.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.VF2Layout.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>
|
||
|