Return a dict of neighbors of node n. Use the expression ‘G[n]’.
Parameters : | n : node
|
---|---|
Returns : | adj_dict : dictionary
|
Notes
G[n] is similar to G.neighbors(n) but the internal data dictionary is returned instead of a list.
Assigning G[n] will corrupt the internal graph data structure. Use G[n] for reading data only.
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_path([0,1,2,3])
>>> G[0]
{1: {}}