
    Gd4                     R    d Z ddlZddlmZmZ dgZ ed          dd            ZdS )zSemiconnectedness.    N)not_implemented_forpairwiseis_semiconnected
undirectedc                 "    t                     dk    rt          j        d          t          j                   sdS t          j                    |t          j                   }t           fdt          |          D                       S )a  Returns True if the graph is semiconnected, False otherwise.

    A graph is semiconnected if, and only if, for any pair of nodes, either one
    is reachable from the other, or they are mutually reachable.

    Parameters
    ----------
    G : NetworkX graph
        A directed graph.

    topo_order: list or tuple, optional
        A topological order for G (if None, the function will compute one)

    Returns
    -------
    semiconnected : bool
        True if the graph is semiconnected, False otherwise.

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

    NetworkXPointlessConcept
        If the graph is empty.

    Examples
    --------
    >>> G = nx.path_graph(4, create_using=nx.DiGraph())
    >>> print(nx.is_semiconnected(G))
    True
    >>> G = nx.DiGraph([(1, 2), (3, 2)])
    >>> print(nx.is_semiconnected(G))
    False

    See Also
    --------
    is_strongly_connected
    is_weakly_connected
    is_connected
    is_biconnected
    r   z-Connectivity is undefined for the null graph.FNc              3   J   K   | ]\  }}                     ||          V  d S N)has_edge).0uvGs      Llib/python3.11/site-packages/networkx/algorithms/components/semiconnected.py	<genexpr>z#is_semiconnected.<locals>.<genexpr>@   s5      AADAqqzz!QAAAAAA    )lennxNetworkXPointlessConceptis_weakly_connectedcondensationtopological_sortallr   )r   
topo_orders   ` r   r   r      s    X 1vv{{);
 
 	
 !!$$ u
A(++
AAAAHZ,@,@AAAAAAr   r	   )__doc__networkxr   networkx.utilsr   r   __all__r    r   r   <module>r      ss          8 8 8 8 8 8 8 8
 \""7B 7B 7B #"7B 7B 7Br   