Return a list of the nodes connected to the node n.
Parameters : | n : node
|
---|---|
Returns : | nlist : list
|
Raises : | NetworkXError :
|
Notes
It is usually more convenient (and faster) to access the adjacency dictionary as G[n]:
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_edge('a','b',weight=7)
>>> G['a']
{'b': {'weight': 7}}
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_path([0,1,2,3])
>>> G.neighbors(0)
[1]