code: def diversify_csr(
      graph_indptr,
      graph_indices,
      graph_data,
      source_data,
      dist,
      rng_state,
      prune_probability=1.0,
  ):
      n_nodes = graph_indptr.shape[0] - 1
  
      for i in numba.prange(n_nodes):
          current_indices = graph_indices[
              graph_indptr[i] : graph_indptr[i + 1]
          ]
          current_data = graph_data[
              graph_indptr[i] : graph_indptr[i + 1]
          ]
  
          order = np.argsort(current_data)
          retained = np.ones(order.shape[0], dtype=np.int8)
  
          for idx in range(1, order.shape[0]):
              j = order[idx]
              for k in range(idx):
                  l = order[k]
                  if retained[l] == 1:
                      d = dist(
                          source_data[current_indices[j]],
                          source_data[current_indices[k]],
                      )
                      if (
                          current_data[l] > FLOAT32_EPS
                          and d < current_data[j]
                      ):
                          if tau_rand(rng_state) < prune_probability:
                              retained[j] = 0
                              break
  
          for idx in range(order.shape[0]):
              j = order[idx]
              if retained[j] == 0:
                  graph_data[graph_indptr[i] + j] = 0
  
      return
  
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 12 for calling a global function with example usage: diversify_csr(graph_indptr, graph_indices, graph_data, source_data, dist, rng_state, prune_probability) without return types