NetworkX

Previous topic

networkx.LabeledDiGraph.get_edge

Next topic

networkx.LabeledDiGraph.neighbors_iter

Quick search

networkx.LabeledDiGraph.neighbors

LabeledDiGraph.neighbors(n)

Return a list of the nodes connected to the node n.

Notes

It is sometimes more convenient (and faster) to access the adjacency dictionary as G[n]

>>> G=nx.Graph()
>>> G.add_edge('a','b','data')
>>> G['a']
{'b': 'data'}

Examples

>>> G=nx.path_graph(4)
>>> G.neighbors(0)
[1]