grassp.tl.get_n_nearest_neighbors#
- get_n_nearest_neighbors(G, node, order=1, n=10)[source]#
Get n nearest neighbors up to a specified order.
- Parameters:
- G
NetworkX graph
- node
str
Node to find neighbors for
- order
int
(default:1
) Order of neighbors to find (1 = direct neighbors, 2 = neighbors of neighbors, etc.)
- n
int
(default:10
) Number of nearest neighbors to find at each step
- Returns:
set Set of nodes that are neighbors up to the specified order