#NEWLINE# def all_neighbors( graph , node ) : #NEWLINE# #INDENT# ' Returns all of the neighbors of a node in the graph.\n\n    If the graph is directed returns predecessors as well as successors.\n\n    Parameters\n    ----------\n    graph : NetworkX graph\n        Graph to find neighbors.\n\n    node : node\n        The node whose neighbors will be returned.\n\n    Returns\n    -------\n    neighbors : iterator\n        Iterator of neighbors\n    ' #NEWLINE# if graph . is_directed ( ) : #NEWLINE# #INDENT# values = chain ( graph . predecessors ( node ) , graph . successors ( node ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# values = graph . neighbors ( node ) #NEWLINE# #UNINDENT# return values