ó
|£*^c           @   sI   d  Z  d d l Z d j d d g ƒ Z d d g Z d „  Z d	 „  Z d S(
   s8   
Functions for identifying isolate (degree zero) nodes.
iÿÿÿÿNs   
s!   Drew Conway <drew.conway@nyu.edu>s   Aric Hagberg <hagberg@lanl.gov>t
   is_isolatet   isolatesc         C   s   |  j  | ƒ d k S(   s©  Determine of node n is an isolate (degree zero).  

    Parameters
    ----------
    G : graph
        A networkx graph
    n : node
        A node in G

    Returns
    -------
    isolate : bool
       True if n has no neighbors, False otherwise.
    
    Examples
    --------
    >>> G=nx.Graph()
    >>> G.add_edge(1,2)
    >>> G.add_node(3)
    >>> nx.is_isolate(G,2)
    False
    >>> nx.is_isolate(G,3)
    True
    i    (   t   degree(   t   Gt   n(    (    so   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/algorithms/isolate.pyR       s    c         C   s/   g  |  j  ƒ  D] \ } } | d k r | ^ q S(   sŠ  Return list of isolates in the graph.

    Isolates are nodes with no neighbors (degree zero).

    Parameters
    ----------
    G : graph
        A networkx graph

    Returns
    -------
    isolates : list
       List of isolate nodes.
    
    Examples
    --------
    >>> G = nx.Graph()
    >>> G.add_edge(1,2)
    >>> G.add_node(3)
    >>> nx.isolates(G)
    [3]

    To remove all isolates in the graph use
    >>> G.remove_nodes_from(nx.isolates(G))
    >>> G.nodes()
    [1, 2]

    For digraphs isolates have zero in-degree and zero out_degre
    >>> G = nx.DiGraph([(0,1),(1,2)])
    >>> G.add_node(3)
    >>> nx.isolates(G)
    [3]
    i    (   t   degree_iter(   R   R   t   d(    (    so   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/algorithms/isolate.pyR   +   s    "(   t   __doc__t   networkxt   nxt   joint
   __author__t   __all__R    R   (    (    (    so   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/algorithms/isolate.pyt   <module>   s   		