grinpy.functions.neighborhoods.closed_neighborhood

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

Return a list of all neighbors of the nodes in nbunch, including 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 together with all nodes in nbunch.

neighborhood

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