%reload_ext autoreload
%autoreload 2
import sys

sys.path.append("../..")
from clonk.backend_utils import FakeHatlab

backend_hatlab = FakeHatlab(dimension=1, router_as_qubits=False)

from clonk.utils.transpiler_passes import level_0_pass_manager

pm_hypercube = level_0_pass_manager(
    backend_hatlab,
    basis_gate="riswap",
    routing="basic",
    decompose_swaps=False,
    decompose_1q=False,
)

from qiskit import QuantumCircuit

circuit = QuantumCircuit(20)
circuit.cx(1, 4)
circuit.cx(3, 2)
circuit.cx(6, 8)
# circuit.draw()

transp = pm_hypercube.run(circuit)
transp.draw(output="mpl")

from qiskit.converters import circuit_to_dag
from qiskit.visualization import dag_drawer

dag = circuit_to_dag(transp)
dag_drawer(dag)