def all_neighbors(graph, node):
 if graph.is_directed():
  values = chain(graph.predecessors(node), graph.successors(node))
 else:
  values = graph.neighbors(node)
 return values

def all_neighbors ( graph , node ) : if graph . is_directed ( ) : values = chain ( graph . predecessors ( node ) , graph . successors ( node ) ) else : values = graph . neighbors ( node ) return values
returns all of the neighbors of a node in the graph .