K ifLdZdgZddlZejddddZy)z Ego graph. ego_graphNT)preserve_all_attrs returns_graphc|r]|+tj|j|||\}}ngttj|j||}n7|tj||||\}}ntj|||}|j |j }|s|j||S)aReturns 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. )cutoffweight)r)nxsingle_source_dijkstra to_undirecteddict"single_source_shortest_path_lengthsubgraphcopy remove_node) Gnradiuscenter undirecteddistancesp_Hs ]/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/networkx/generators/ego.pyrr sH  --!1VHEB55OO%qB  --a6(SEB66q!FKB 2A  a H)TFN)__doc____all__networkxr _dispatchablerrrr"s9 -T>7 ?7 r