networkx.DiGraph.neighbors
networkx.DiGraph.__getitem__
Return an iterator over all neighbors of node n.
Notes
It is faster to iterate over the using the idiom >>> print [n for n in G[0]] [1]
Examples
>>> G=nx.path_graph(4) >>> print [n for n in G.neighbors(0)] [1]