networkx.classes.function.all_neighbors

all_neighbors(graph, node)[source]

Returns all of the neighbors of a node in the graph.

If the graph is directed returns predecessors as well as successors.

Parameters
graphNetworkX graph

Graph to find neighbors.

nodenode

The node whose neighbors will be returned.

Returns
neighborsiterator

Iterator of neighbors