code: def average_nn_distance(dist_matrix):
      """Calculate the average distance to each points nearest neighbors.
  
      Parameters
      ----------
      dist_matrix: a csr_matrix
          A distance matrix (usually umap_model.graph_)
  
      Returns
      -------
      An array with the average distance to each points nearest neighbors
  
      """
      (row_idx, col_idx, val) = scipy.sparse.find(dist_matrix)
  
      # Count/sum is done per row
      count_non_zero_elems = np.bincount(row_idx)
      sum_non_zero_elems = np.bincount(row_idx, weights=val)
      averages = sum_non_zero_elems / count_non_zero_elems
  
      if any(np.isnan(averages)):
          warn(
              "Embedding contains disconnected vertices which will be ignored."
              "Use umap.utils.disconnected_vertices() to identify them."
          )
  
      return averages
  
file_path: umap/umap/utils.py
imports: import time
  from warnings import warn
  import numpy
  import numba
  from sklearn.utils.validation import check_is_fitted
  import scipy.sparse
label_desc: Use image node_id 9 for calling a global function with example usage: average_nn_distance(dist_matrix) and returns: averages