vf2pp_layout#
Module: iqm.qrisp_iqm.passes.routing
- iqm.qrisp_iqm.passes.routing.vf2pp_layout(connectivity: list[tuple[int, int]]) Callable[[QuantumCircuit], QuantumCircuit]#
Create a pass that finds a qubit layout using VF2++ subgraph isomorphism.
This pass uses the VF2++ algorithm to find a subgraph isomorphism between the circuit’s connectivity graph and the hardware topology. If a valid mapping exists, the circuit can be executed without any SWAP gates.
- Parameters:
connectivity (list[tuple[int]]) – The list of edges representing the hardware topology.
- Returns:
A pass function that transforms the circuit.
- Return type:
Callable[[QuantumCircuit], QuantumCircuit]
- Raises:
ValueError – If no valid subgraph isomorphism can be found (the circuit’s connectivity graph is not embeddable in the topology).
Example
>>> from qrisp import QuantumCircuit, PassManager >>> from iqm.qrisp_iqm import vf2pp_layout >>> qc = QuantumCircuit(2); qc.cx(0, 1); qc.measure(qc.qubits) >>> pm = PassManager() >>> pm += vf2pp_layout(connectivity=[(0,1), (1,2)]) >>> transpiled_qc = pm.run(qc)