§
    \ùMh‘  ã                   ó‚   — d Z ddlZddgZ ej        d¬¦  «        d„ ¦   «         Z ej        d¬¦  «        d„ ¦   «         ZdS )	z$
Utilities for connectivity package
é    NÚ!build_auxiliary_node_connectivityÚ!build_auxiliary_edge_connectivityT)Úreturns_graphc                 óR  — |                       ¦   «         }i }t          j        ¦   «         }t          | ¦  «        D ]\\  }}|||<   |                     |› d|¬¦  «         |                     |› d|¬¦  «         |                     |› d|› dd¬¦  «         Œ]g }|                      ¦   «         D ]Y\  }}|                     ||         › d||         › df¦  «         |s)|                     ||         › d||         › df¦  «         ŒZ|                     |d¬¦  «         ||j	        d<   |S )a/  Creates a directed graph D from an undirected graph G to compute flow
    based node connectivity.

    For an undirected graph G having `n` nodes and `m` edges we derive a
    directed graph D with `2n` nodes and `2m+n` arcs by replacing each
    original node `v` with two nodes `vA`, `vB` linked by an (internal)
    arc in D. Then for each edge (`u`, `v`) in G we add two arcs (`uB`, `vA`)
    and (`vB`, `uA`) in D. Finally we set the attribute capacity = 1 for each
    arc in D [1]_.

    For a directed graph having `n` nodes and `m` arcs we derive a
    directed graph D with `2n` nodes and `m+n` arcs by replacing each
    original node `v` with two nodes `vA`, `vB` linked by an (internal)
    arc (`vA`, `vB`) in D. Then for each arc (`u`, `v`) in G we add one
    arc (`uB`, `vA`) in D. Finally we set the attribute capacity = 1 for
    each arc in D.

    A dictionary with a mapping between nodes in the original graph and the
    auxiliary digraph is stored as a graph attribute: D.graph['mapping'].

    References
    ----------
    .. [1] Kammer, Frank and Hanjo Taubig. Graph Connectivity. in Brandes and
        Erlebach, 'Network Analysis: Methodological Foundations', Lecture
        Notes in Computer Science, Volume 3418, Springer-Verlag, 2005.
        https://doi.org/10.1007/978-3-540-31955-9_7

    ÚA)ÚidÚBé   ©ÚcapacityÚmapping)
Úis_directedÚnxÚDiGraphÚ	enumerateÚadd_nodeÚadd_edgeÚedgesÚappendÚadd_edges_fromÚgraph)	ÚGÚdirectedr   ÚHÚiÚnoder   ÚsourceÚtargets	            úf/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/networkx/algorithms/connectivity/utils.pyr   r   
   s\  € ð< }Š}‰Œ€Hà€GÝ
Œ
‰Œ€Aå˜Q‘<”<ð 1ð 1‰ˆˆ4Øˆ‰Ø	
Š
a777˜tˆ
Ñ$Ô$Ð$Ø	
Š
a777˜tˆ
Ñ$Ô$Ð$Ø	
Š
a777˜q˜G˜G˜G¨aˆ
Ñ0Ô0Ð0Ð0à€EØŸ'š'™)œ)ð Ið I‰ˆØŠ˜ œÐ+Ð+Ð+°¸´Ð-BÐ-BÐ-BÐCÑDÔDÐDØð 	IØLŠL˜W Vœ_Ð/Ð/Ð/°G¸F´OÐ1FÐ1FÐ1FÐGÑHÔHÐHøØ×ÒU QÐÑ'Ô'Ð'ð !€A„GˆIÑØ€Hó    c                 óÚ  — |                       ¦   «         ret          j        ¦   «         }|                     |                      ¦   «         ¦  «         |                     |                      ¦   «         d¬¦  «         |S t          j        ¦   «         }|                     |                      ¦   «         ¦  «         |                      ¦   «         D ]"\  }}|                     ||f||fgd¬¦  «         Œ#|S )aR  Auxiliary digraph for computing flow based edge connectivity

    If the input graph is undirected, we replace each edge (`u`,`v`) with
    two reciprocal arcs (`u`, `v`) and (`v`, `u`) and then we set the attribute
    'capacity' for each arc to 1. If the input graph is directed we simply
    add the 'capacity' attribute. Part of algorithm 1 in [1]_ .

    References
    ----------
    .. [1] Abdol-Hossein Esfahanian. Connectivity Algorithms. (this is a
        chapter, look for the reference of the book).
        http://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf
    r
   r   )r   r   r   Úadd_nodes_fromÚnodesr   r   )r   r   r   r   s       r   r   r   ?   sÕ   € ð 	‡}‚}„ð 
ÝŒJ‰LŒLˆØ	×Ò˜Ÿš™œÑ#Ô#Ð#Ø	×Ò˜Ÿš™œ¨QÐÑ/Ô/Ð/ØˆåŒJ‰LŒLˆØ	×Ò˜Ÿš™œÑ#Ô#Ð#ØŸgšg™iœið 	Oð 	O‰NˆFFØ×Ò˜v vÐ.°¸Ð0@ÐAÈAÐÑNÔNÐNÐNØˆr    )Ú__doc__Únetworkxr   Ú__all__Ú_dispatchabler   r   © r    r   ú<module>r)      s‹   ððð ð Ð Ð Ð à.Ð0SÐ
T€ð €Ô Ð%Ñ%Ô%ð1ð 1ñ &Ô%ð1ðh €Ô Ð%Ñ%Ô%ðð ñ &Ô%ðð ð r    