code: def init_rp_tree(inds, indptr, data, dist, current_graph, leaf_array):
      n_leaves = leaf_array.shape[0]
      block_size = 65536
      n_blocks = n_leaves // block_size
  
      for i in range(n_blocks + 1):
          block_start = i * block_size
          block_end = min(n_leaves, (i + 1) * block_size)
  
          leaf_block = leaf_array[block_start:block_end]
          dist_thresholds = current_graph[1][:, 0]
  
          updates = generate_leaf_updates(
              leaf_block, dist_thresholds, inds, indptr, data, dist
          )
  
          for j in range(len(updates)):
              for k in range(len(updates[j])):
                  p, q, d = updates[j][k]
  
                  if p == -1 or q == -1:
                      continue
  
                  checked_flagged_heap_push(
                      current_graph[1][p],
                      current_graph[0][p],
                      current_graph[2][p],
                      d,
                      q,
                      np.uint8(1),
                  )
                  checked_flagged_heap_push(
                      current_graph[1][q],
                      current_graph[0][q],
                      current_graph[2][q],
                      d,
                      p,
                      np.uint8(1),
                  )
  
file_path: pynndescent/pynndescent/sparse_nndescent.py
imports: from __future__ import print_function
  import locale
  import numpy
  import numba
  from pynndescent.utils import tau_rand_int, make_heap, new_build_candidates, deheap_sort, checked_flagged_heap_push, apply_graph_updates_high_memory, apply_graph_updates_low_memory
  from pynndescent.sparse import sparse_euclidean
label_desc: Use image node_id 2 for calling a global function with example usage: init_rp_tree(inds, indptr, data, dist, current_graph, leaf_array) without return types