grinpy.functions.neighborhoods.neighborhood(G, nbunch)

Return a list of all neighbors of the nodes in nbunch.

G : graph
A NetworkX graph.

nbunch : a single node or iterable container

neighbors : list
A list containing all nodes that are a neighbor of some node in nbunch.


>>> G = nx.path_graph(3) # Path on 3 nodes
>>> nx.neighborhood(G, 1)
[0, 2]