§
    º³Ùg€  ã                   ó*   — d Z ddlmZ ddlmZ dd„ZdS )	zUtility functions for routingé    )ÚTranspilerErroré   )ÚApproximateTokenSwapperé   c                 óF  ‡‡
— t          | j        ¦  «        dk    s| j                             dd¦  «        €t          d¦  «        ‚t          | j        ¦  «        t          |j        ¦  «        k    rt          d¦  «        ‚t          |j                             ¦   «         |¦  «        }ˆfd„| 	                    ¦   «          
                    ¦   «         D ¦   «         }|                     ||¦  «        \  }}	d„ |	 
                    ¦   «         D ¦   «         Š
|ˆ
fd„|j        D ¦   «         fS )	z�Get 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 DAGc                 ó(   •— i | ]\  }}|‰|         “ŒS © r
   )Ú.0ÚvqubitÚpqubitÚ	to_layouts      €ú\/granary/edev/quantum/lib/python3.11/site-packages/qiskit/transpiler/passes/routing/utils.pyú
<dictcomp>z$get_swap_map_dag.<locals>.<dictcomp>   s1   ø€ ð ð ð Ù&4 f¨fˆ�	˜&Ô!ðð ð ó    c                 ó   — i | ]\  }}||“Œ	S r
   r
   )r   ÚouterÚinners      r   r   z$get_swap_map_dag.<locals>.<dictcomp>"   s   € ÐWÐWÐW©¨¨u�u˜eÐWÐWÐWr   c                 ó    •— g | ]
}‰|         ‘ŒS r
   r
   )r   ÚbitÚcircuit_to_physs     €r   ú
<listcomp>z$get_swap_map_dag.<locals>.<listcomp>#   s   ø€ ÐNÐNÐN°3˜/¨#Ô.ÐNÐNÐNr   )ÚlenÚqregsÚgetr   ÚqubitsÚphysical_qubitsr   ÚgraphÚto_undirectedÚget_virtual_bitsÚitemsÚpermutation_circuit)ÚdagÚcoupling_mapÚfrom_layoutr   ÚseedÚtrialsÚtoken_swapperÚpermutationÚswap_circuitÚphys_to_circuit_qubitsr   s      `      @r   Úget_swap_map_dagr,      s*  øø€ õ ˆ3Œ9�~„~˜ÒÐ˜cœiŸmšm¨C°Ñ6Ô6Ð>ÝÐTÑUÔUÐUÝ
ˆ3Œ:�„�˜\Ô9Ñ:Ô:Ò:Ð:ÝÐYÑZÔZÐZÝ+¨LÔ,>×,LÒ,LÑ,NÔ,NÐPTÑUÔU€Mðð ð ð Ø8C×8TÒ8TÑ8VÔ8V×8\Ò8\Ñ8^Ô8^ðñ ô €Kð
 ,9×+LÒ+LÈ[ÐZ`Ñ+aÔ+aÑ(€LÐ(ØWÐWÐ8N×8TÒ8TÑ8VÔ8VÐWÑWÔW€OØÐNÐNÐNÐN¸,Ô:MÐNÑNÔNÐNÐNr   N)r   )Ú__doc__Úqiskit.transpiler.exceptionsr   Ú
algorithmsr   r,   r
   r   r   ú<module>r0      sU   ðð $Ð #à 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø /Ð /Ð /Ð /Ð /Ð /ðOð Oð Oð Oð Oð Or   