code: def nn_descent(
      data,
      n_neighbors,
      rng_state,
      max_candidates=50,
      dist=pynnd_dist.euclidean,
      n_iters=10,
      delta=0.001,
      init_graph=EMPTY_GRAPH,
      rp_tree_init=True,
      leaf_array=None,
      low_memory=True,
      verbose=False,
  ):
      if init_graph[0].shape[0] == 1:  # EMPTY_GRAPH
          current_graph = make_heap(data.shape[0], n_neighbors)
  
          if rp_tree_init:
              init_rp_tree(data, dist, current_graph, leaf_array)
  
          init_random(n_neighbors, data, current_graph, dist, rng_state)
      elif (
          init_graph[0].shape[0] == data.shape[0]
          and init_graph[0].shape[1] == n_neighbors
      ):
          current_graph = init_graph
      else:
          raise ValueError("Invalid initial graph specified!")
  
      if low_memory:
          nn_descent_internal_low_memory_parallel(
              current_graph,
              data,
              n_neighbors,
              rng_state,
              max_candidates=max_candidates,
              dist=dist,
              n_iters=n_iters,
              delta=delta,
              verbose=verbose,
          )
      else:
          nn_descent_internal_high_memory_parallel(
              current_graph,
              data,
              n_neighbors,
              rng_state,
              max_candidates=max_candidates,
              dist=dist,
              n_iters=n_iters,
              delta=delta,
              verbose=verbose,
          )
  
      return deheap_sort(current_graph[0], current_graph[1])
  
imports: from warnings import warn
  import numba
  import numpy
  from sklearn.utils import check_random_state, check_array
  from sklearn.preprocessing import normalize
  from sklearn.base import BaseEstimator, TransformerMixin
  from scipy.sparse import csr_matrix, coo_matrix, isspmatrix_csr, vstack, issparse
  import heapq
  import pynndescent.sparse
  import pynndescent.sparse_nndescent
  import pynndescent.distances
  from pynndescent.utils import tau_rand_int, tau_rand, make_heap, deheap_sort, new_build_candidates, ts, simple_heap_push, checked_flagged_heap_push, has_been_visited, mark_visited, apply_graph_updates_high_memory, apply_graph_updates_low_memory, initalize_heap_from_graph_indices, initalize_heap_from_graph_indices_and_distances, sparse_initalize_heap_from_graph_indices
  from pynndescent.rp_trees import make_forest, rptree_leaf_array, convert_tree_format, FlatTree, denumbaify_tree, renumbaify_tree, select_side, sparse_select_side, score_linked_tree
label_desc: Use image node_id 10 for calling a global function with example usage: nn_descent(data, n_neighbors, rng_state, max_candidates, dist, n_iters, delta, init_graph, rp_tree_init, leaf_array, low_memory, verbose) and returns: deheap_sort