Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

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:

graph : NetworkX graph

Graph to find neighbors.

node : node

The node whose neighbors will be returned.

Returns:

neighbors : iterator

Iterator of neighbors