code: def _nhood_search(umap_object, nhood_size):
      if (
          hasattr(umap_object, "_small_data")
          and umap_object._small_data
      ):
          dmat = sklearn.metrics.pairwise_distances(
              umap_object._raw_data
          )
          indices = np.argpartition(dmat, nhood_size)[:, :nhood_size]
          dmat_shortened = submatrix(dmat, indices, nhood_size)
          indices_sorted = np.argsort(dmat_shortened)
          indices = submatrix(indices, indices_sorted, nhood_size)
          dists = submatrix(dmat_shortened, indices_sorted, nhood_size)
      else:
          rng_state = np.empty(3, dtype=np.int64)
  
          indices, dists = umap_object._knn_search_index.query(
              umap_object._raw_data,
              k=nhood_size,
          )
  
      return indices, dists
  
imports: import numpy
  import numba
  from warnings import warn
  import sklearn.decomposition
  import sklearn.cluster
  import sklearn.neighbors
  from matplotlib.patches import Patch
  from umap.utils import submatrix, average_nn_distance
  from bokeh.plotting import show
  from bokeh.plotting import output_file, output_notebook
  from bokeh.layouts import column
  from bokeh.models import CustomJS, TextInput
  from matplotlib.pyplot import show
  from warnings import warn
label_desc: Use image node_id 9 for calling a global function with example usage: _nhood_search(umap_object, nhood_size) and returns: indices,  dists