
    \Mhf                     P    d Z dgZddlZ ej        dd          d	d            ZdS )
z
Ego graph.
	ego_graph    NT)preserve_all_attrsreturns_graph   Fc                    |rg|.t          j        |                                 |||          \  }}nlt          t          j        |                                 ||                    }n5|t          j        | |||          \  }}nt          j        | ||          }|                     |                                          }|s|                    |           |S )a  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.
    N)cutoffweight)r   )nxsingle_source_dijkstrato_undirecteddict"single_source_shortest_path_lengthsubgraphcopyremove_node)	Gnradiuscenter
undirecteddistancesp_Hs	            W/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/networkx/generators/ego.pyr   r   
   s    H  L-!!1VH  EB 5OO%%q   BB -a6(SSSEB6q!FKKKB	

2A 	aH    )r   TFN)__doc____all__networkxr
   _dispatchabler    r   r   <module>r"      sa     -     T>>>7 7 7 ?>7 7 7r   