
    z	i                    b    S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr      S
S jrg	)z=This module contains common utils for disjoint coupling maps.    )annotations)Union)
DAGCircuit)CouplingMap)Target)TranspilerErrorc           
        [        U[        5      (       a  UR                  SS9nOUnUR                  5        Vs/ s H&  n[	        UR
                  R                  5       5      PM(     nnU R                  5        H  nSn[        U5       H5  u  pxU R                  UR                  S   5      R                  U;   d  M3  Un  O   U R                  UR                  S   5      R                  XF   ;  d  My  [        SU R                  UR                  S   5      R                   SU R                  UR                  S   5      R                   S35      e   gs  snf )	a#  
Check that the layout of the dag does not require connectivity across connected components
in the CouplingMap

Args:
    dag: DAGCircuit to check.
    components_source: Target to check against.

Raises:
    TranspilerError: Chosen layout is not valid for the target disjoint connectivity.
T)filter_idle_qubitsNr      zThe circuit has an invalid layout as two qubits need to interact in disconnected components of the coupling map. The physical qubit z" needs to interact with the qubit z( and they belong to different components)
isinstancer   build_coupling_mapconnected_componentssetgraphnodestwo_qubit_ops	enumeratefind_bitqargsindexr   )	dagcomponents_sourcecoupling_mapxcomponent_setsinstcomponent_indexicomponent_sets	            h/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/transpiler/passes/layout/disjoint_utils.py$require_layout_isolated_to_componentr!      s.    #V,,(;;t;T(4@4U4U4WX4Wqc!''--/*4WNX!!# ). 9A||DJJqM*00MA"# !: <<

1&,,N4SS!F<<

1.445 6djjm4::;;ce  $ Ys   -EN)r   r   r   zUnion[Target, CouplingMap])__doc__
__future__r   typingr   qiskit.dagcircuit.dagcircuitr   qiskit.transpiler.couplingr   qiskit.transpiler.targetr   qiskit.transpiler.exceptionsr   r!        r    <module>r+      s2    D "  3 2 + 8	(Br*   