ó
|£*^c           @   sI   d  Z  d j d d g ƒ Z d g Z d d l Z d e e d d „ Z	 d S(	   s   
Ego graph.
s   
s!   Drew Conway <drew.conway@nyu.edu>s   Aric Hagberg <hagberg@lanl.gov>t	   ego_graphiÿÿÿÿNi   c   	      C   sÚ   | r` | d k	 r? t j |  j ƒ  | d | d | ƒ\ } } q« t j |  j ƒ  | d | ƒ} nK | d k	 r“ t j |  | d | d | ƒ\ } } n t j |  | d | ƒ} |  j | ƒ j ƒ  } | sÖ | j | ƒ n  | S(   s  Returns induced subgraph of neighbors centered at node n within
    a given radius.
    
    Parameters
    ----------
    G : graph
      A NetworkX Graph or DiGraph

    n : node 
      A single node 

    radius : number, optional
      Include all neighbors of distance<=radius from n.
      
    center : bool, optional
      If False, do not include center node in graph 

    undirected : bool, optional      
      If True use both in- and out-neighbors of directed graphs.

    distance : key, optional      
      Use specified edge data key as distance.  For example, setting
      distance='weight' will use the edge weight to measure the
      distance from the node n.

    Notes
    -----
    For directed graphs D this produces the "out" neighborhood
    or successors.  If you want the neighborhood of predecessors
    first reverse the graph with D.reverse().  If you want both
    directions use the keyword argument undirected=True.

    Node, edge, and graph attributes are copied to the returned subgraph.
    t   cutofft   weightN(   t   Nonet   nxt   single_source_dijkstrat   to_undirectedt"   single_source_shortest_path_lengtht   subgrapht   copyt   remove_node(	   t   Gt   nt   radiust   centert
   undirectedt   distancet   spt   _t   H(    (    sk   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/generators/ego.pyR       s     #	(
   t   __doc__t   joint
   __author__t   __all__t   networkxR   t   Truet   FalseR   R    (    (    (    sk   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/generators/ego.pyt   <module>   s
   		