§
    bŠtj˜
  ã                   óì   — d Z ddlZddlmZ g d¢Z ed¦  «        ej        d„ ¦   «         ¦   «         Z ed¦  «        ej        d„ ¦   «         ¦   «         Z ed¦  «        ej        d„ ¦   «         ¦   «         Z	dS )	zAttracting components.é    N)Únot_implemented_for)Únumber_attracting_componentsÚattracting_componentsÚis_attracting_componentÚ
undirectedc              #   óÆ   K  — t          t          j        | ¦  «        ¦  «        }t          j        | |¦  «        }|D ]%}|                     |¦  «        dk    r
||         V — Œ&dS )aá  Generates the attracting components in `G`.

    An attracting component in a directed graph `G` is a strongly connected
    component with the property that a random walker on the graph will never
    leave the component, once it enters the component.

    The nodes in attracting components can also be thought of as recurrent
    nodes.  If a random walker enters the attractor containing the node, then
    the node will be visited infinitely often.

    To obtain induced subgraphs on each component use:
    ``(G.subgraph(c).copy() for c in attracting_components(G))``

    Parameters
    ----------
    G : DiGraph, MultiDiGraph
        The graph to be analyzed.

    Returns
    -------
    attractors : generator of sets
        A generator of sets of nodes, one for each attracting component of G.

    Raises
    ------
    NetworkXNotImplemented
        If the input graph is undirected.

    See Also
    --------
    number_attracting_components
    is_attracting_component

    r   N)ÚlistÚnxÚstrongly_connected_componentsÚcondensationÚ
out_degree)ÚGÚsccÚcGÚns       úg/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/algorithms/components/attracting.pyr   r      sp   è è € õJ �rÔ/°Ñ2Ô2Ñ
3Ô
3€CÝ	Œ˜˜CÑ	 Ô	 €BØð ð ˆØ�=Š=˜ÑÔ˜qÒ Ð Ø�a”&ˆLˆLˆLøðð ó    c                 óN   — t          d„ t          | ¦  «        D ¦   «         ¦  «        S )aœ  Returns the number of attracting components in `G`.

    Parameters
    ----------
    G : DiGraph, MultiDiGraph
        The graph to be analyzed.

    Returns
    -------
    n : int
        The number of attracting components in G.

    Raises
    ------
    NetworkXNotImplemented
        If the input graph is undirected.

    See Also
    --------
    attracting_components
    is_attracting_component

    c              3   ó   K  — | ]}d V — ŒdS )é   N© )Ú.0Úacs     r   ú	<genexpr>z/number_attracting_components.<locals>.<genexpr>S   s"   è è € Ð4Ð4�RˆqÐ4Ð4Ð4Ð4Ð4Ð4r   )Úsumr   )r   s    r   r   r   9   s*   € õ4 Ð4Ð4Õ0°Ñ3Ô3Ð4Ñ4Ô4Ñ4Ô4Ð4r   c                 ó°   — t          t          | ¦  «        ¦  «        }t          |¦  «        dk    r&t          |d         ¦  «        t          | ¦  «        k    S dS )aÍ  Returns True if `G` consists of a single attracting component.

    Parameters
    ----------
    G : DiGraph, MultiDiGraph
        The graph to be analyzed.

    Returns
    -------
    attracting : bool
        True if `G` has a single attracting component. Otherwise, False.

    Raises
    ------
    NetworkXNotImplemented
        If the input graph is undirected.

    See Also
    --------
    attracting_components
    number_attracting_components

    r   r   F)r	   r   Úlen)r   r   s     r   r   r   V   sI   € õ4 
Õ# AÑ&Ô&Ñ	'Ô	'€BÝ
ˆ2�w„w�!‚|€|Ý�2�a”5‰zŒz�S ™VœVÒ#Ð#Øˆ5r   )
Ú__doc__Únetworkxr
   Únetworkx.utils.decoratorsr   Ú__all__Ú_dispatchabler   r   r   r   r   r   ú<module>r#      sä   ðØ Ð à Ð Ð Ð Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9ðð ð €ð Ð�\Ñ"Ô"ØÔð'ð 'ñ Ôñ #Ô"ð'ðT Ð�\Ñ"Ô"ØÔð5ð 5ñ Ôñ #Ô"ð5ð6 Ð�\Ñ"Ô"ØÔðð ñ Ôñ #Ô"ðð ð r   