§
    bŠtjÛ  ã                   ó„   — d Z ddlmZ ddlZddgZ ej        ddid¬¦  «        dd
„¦   «         Zej        dd„¦   «         ZdS )aY  Routines to find the boundary of a set of nodes.

An edge boundary is a set of edges, each of which has exactly one
endpoint in a given set of nodes (or, in the case of directed graphs,
the set of edges whose source node is in the set).

A node boundary of a set *S* of nodes is the set of (out-)neighbors of
nodes in *S* that are outside *S*.

é    )ÚchainNÚedge_boundaryÚnode_boundaryÚdataÚdefault)Ú
edge_attrsÚpreserve_edge_attrsFc                 ó  ‡ ‡‡— ˆ fd„|D ¦   «         Š‰                       ¦   «         r‰                      ‰|||¬¦  «        }n‰                      ‰||¬¦  «        }|€ˆfd„|D ¦   «         S t          |¦  «        Šˆˆfd„|D ¦   «         S )a’  Returns the edge boundary of `nbunch1`.

    The *edge boundary* of a set *S* with respect to a set *T* is the
    set of edges (*u*, *v*) such that *u* is in *S* and *v* is in *T*.
    If *T* is not specified, it is assumed to be the set of all nodes
    not in *S*.

    Parameters
    ----------
    G : NetworkX graph

    nbunch1 : iterable
        Iterable of nodes in the graph representing the set of nodes
        whose edge boundary will be returned. (This is the set *S* from
        the definition above.)

    nbunch2 : iterable
        Iterable of nodes representing the target (or "exterior") set of
        nodes. (This is the set *T* from the definition above.) If not
        specified, this is assumed to be the set of all nodes in `G`
        not in `nbunch1`.

    keys : bool
        This parameter has the same meaning as in
        :meth:`MultiGraph.edges`.

    data : bool or object
        This parameter has the same meaning as in
        :meth:`MultiGraph.edges`.

    default : object
        This parameter has the same meaning as in
        :meth:`MultiGraph.edges`.

    Returns
    -------
    iterator
        An iterator over the edges in the boundary of `nbunch1` with
        respect to `nbunch2`. If `keys`, `data`, or `default`
        are specified and `G` is a multigraph, then edges are returned
        with keys and/or data, as in :meth:`MultiGraph.edges`.

    Examples
    --------
    >>> G = nx.wheel_graph(6)

    When nbunch2=None:

    >>> list(nx.edge_boundary(G, (1, 3)))
    [(1, 0), (1, 2), (1, 5), (3, 0), (3, 2), (3, 4)]

    When nbunch2 is given:

    >>> list(nx.edge_boundary(G, (1, 3), (2, 0)))
    [(1, 0), (1, 2), (3, 0), (3, 2)]

    Notes
    -----
    Any element of `nbunch` that is not in the graph `G` will be
    ignored.

    `nbunch1` and `nbunch2` are usually meant to be disjoint, but in
    the interest of speed and generality, that is not required here.

    c                 ó   •— h | ]}|‰v ¯|’Œ	S © r   ©Ú.0ÚnÚGs     €úZ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/algorithms/boundary.pyú	<setcomp>z edge_boundary.<locals>.<setcomp>V   ó   ø€ Ð*Ð*Ð*�1 1¨ 6 6ˆQ 6 6 6ó    )r   Úkeysr   )r   r   Nc              3   óF   •K  — | ]}|d          ‰v |d         ‰v z  ¯|V — ŒdS ©r   é   Nr   )r   ÚeÚnset1s     €r   ú	<genexpr>z edge_boundary.<locals>.<genexpr>e   s=   øè è € ÐFÐF�a Q q¤T¨U ]°q¸´t¸u°}Ñ$EÐF�ÐFÐFÐFÐFÐFÐFr   c              3   ól   •K  — | ].}|d          ‰v r
|d         ‰v s|d         ‰v ¯ |d          ‰v ¯*|V — Œ/dS r   r   )r   r   r   Únset2s     €€r   r   z edge_boundary.<locals>.<genexpr>g   s]   øè è € ð ð àØˆaŒD�EˆMˆM˜a œd e˜m˜m°°1´¸°°À1ÀQÄ4È5À=À=ð 	
àCPÀ=À=À=ðð r   )Úis_multigraphÚedgesÚset)	r   Únbunch1Únbunch2r   r   r   r   r   r   s	   `      @@r   r   r      sÃ   øøø€ ðF +Ð*Ð*Ð*˜Ð*Ñ*Ô*€Eð 	‡‚ÑÔð ;Ø—’˜ D¨t¸W�ÑEÔEˆˆà—’˜ D°'�Ñ:Ô:ˆð
 €ØFÐFÐFÐF˜5ÐFÑFÔFÐFÝ�‰LŒL€Eðð ð ð ð àðñ ô ð r   c                 ó¬   ‡ — ˆ fd„|D ¦   «         }t          t          j        ˆ fd„|D ¦   «         ¦  «        ¦  «        |z
  }|�|t          |¦  «        z  }|S )ac  Returns the node boundary of `nbunch1`.

    The *node boundary* of a set *S* with respect to a set *T* is the
    set of nodes *v* in *T* such that for some *u* in *S*, there is an
    edge joining *u* to *v*. If *T* is not specified, it is assumed to
    be the set of all nodes not in *S*.

    Parameters
    ----------
    G : NetworkX graph

    nbunch1 : iterable
        Iterable of nodes in the graph representing the set of nodes
        whose node boundary will be returned. (This is the set *S* from
        the definition above.)

    nbunch2 : iterable
        Iterable of nodes representing the target (or "exterior") set of
        nodes. (This is the set *T* from the definition above.) If not
        specified, this is assumed to be the set of all nodes in `G`
        not in `nbunch1`.

    Returns
    -------
    set
        The node boundary of `nbunch1` with respect to `nbunch2`.

    Examples
    --------
    >>> G = nx.wheel_graph(6)

    When nbunch2=None:

    >>> list(nx.node_boundary(G, (3, 4)))
    [0, 2, 5]

    When nbunch2 is given:

    >>> list(nx.node_boundary(G, (3, 4), (0, 1, 5)))
    [0, 5]

    Notes
    -----
    Any element of `nbunch` that is not in the graph `G` will be
    ignored.

    `nbunch1` and `nbunch2` are usually meant to be disjoint, but in
    the interest of speed and generality, that is not required here.

    c                 ó   •— h | ]}|‰v ¯|’Œ	S r   r   r   s     €r   r   z node_boundary.<locals>.<setcomp>¢   r   r   c              3   ó(   •K  — | ]}‰|         V — Œd S ©Nr   )r   Úvr   s     €r   r   z node_boundary.<locals>.<genexpr>£   s'   øè è € Ð!6Ð!6¨1 ! A¤$Ð!6Ð!6Ð!6Ð!6Ð!6Ð!6r   )r    r   Úfrom_iterable)r   r!   r"   r   Úbdys   `    r   r   r   n   sn   ø€ ðh +Ð*Ð*Ð*˜Ð*Ñ*Ô*€EÝ
�eÔ!Ð!6Ð!6Ð!6Ð!6°Ð!6Ñ!6Ô!6Ñ6Ô6Ñ
7Ô
7¸%Ñ
?€Cð ÐØ�s�7‰|Œ|ÑˆØ€Jr   )NFFNr&   )	Ú__doc__Ú	itertoolsr   ÚnetworkxÚnxÚ__all__Ú_dispatchabler   r   r   r   r   ú<module>r0      s¥   ðð	ð 	ð Ð Ð Ð Ð Ð à Ð Ð Ð à˜OÐ
,€ð €Ô˜f iÐ0ÀfÐMÑMÔMðWð Wð Wñ NÔMðWðt Ôð9ð 9ð 9ñ Ôð9ð 9ð 9r   