grassp.tl.get_n_nearest_neighbors#
- get_n_nearest_neighbors(G, node, order=1, n=10)[source]#
 Return the set of closest neighbours for a node in a graph.
Starting from
nodethe procedure repeatedly fetches thenstrongest (highest weight) edges for every node discovered so far. After order iterations the union of visited nodes is returned.- Parameters:
 - G
 Weighted
networkx.Graph– typically the output ofto_knn_graph().- node 
str Start node.
- order 
int(default:1) How many hops away to expand.
1(default) returns the direct k-NN;2also includes neighbours of neighbours, and so on.- n 
int(default:10) Number of neighbours per node considered at each expansion step.
- Returns:
 set[str] Node identifiers within the specified neighbourhood radius (including the start node).