# grinpy.functions.neighborhoods.neighborhood¶

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

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

Parameters: G (NetworkX graph) – An undirected graph. nbunch (a single node or iterable container) – A list containing all nodes that are a neighbor of some node in nbunch. list

Examples

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