
    z	i                     *    S r SSKJr  SSKJr  SS jrg)zUtility functions for routing    )TranspilerError   )ApproximateTokenSwapperc                 t   [        U R                  5      S:w  d  U R                  R                  SS5      c  [        S5      e[        U R                  5      [        UR
                  5      :  a  [        S5      e[        UR                  R                  5       U5      nUR                  5       R                  5        VVs0 s H
  u  pxXU   _M     n	nnUR                  X5      u  pUR                  5        VVs0 s H  u  pX_M	     nnnXR                   Vs/ s H  oU   PM	     sn4$ s  snnf s  snnf s  snf )zGet the circuit of swaps to go from from_layout to to_layout, and the physical qubits
(integers) that the swap circuit should be applied on.r   qNz4layout transformation runs on physical circuits onlyz9The layout does not match the amount of qubits in the DAG)lenqregsgetr   qubitsphysical_qubitsr   graphto_undirectedget_virtual_bitsitemspermutation_circuit)dagcoupling_mapfrom_layout	to_layoutseedtrialstoken_swappervqubitpqubitpermutationswap_circuitphys_to_circuit_qubitsouterinnercircuit_to_physbits                   `/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/transpiler/passes/routing/utils.pyget_swap_map_dagr#      s    399~ciimmC6>TUU
3::\99::YZZ+L,>,>,L,L,NPTUM 9D8T8T8V8\8\8^8^nf&!!8^  
 ,9+L+L[+a(L8N8T8T8VW8Vu|8VOW:M:MN:M3#.:MNNN XNs   >D)8D/D5N)   )__doc__qiskit.transpiler.exceptionsr   
algorithmsr   r#        r"   <module>r*      s    $ 8 /Or)   