# neighbors¶

MultiGraph.neighbors(n)

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

Parameters: n : node A node in the graph nlist : list A list of nodes that are adjacent to n. NetworkXError If the node n is not in the graph.

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 = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc