code: def deheap_sort(indices, distances):
      """Given two arrays representing a heap (indices and distances), reorder the
       arrays by increasing distance. This is effectively just the second half of
       heap sort (the first half not being required since we already have the
       graph_data in a heap).
  
       Note that this is done in-place.
  
      Parameters
      ----------
      indices : array of shape (n_samples, n_neighbors)
          The graph indices to sort by distance.
      distances : array of shape (n_samples, n_neighbors)
          The corresponding edge distance.
  
      Returns
      -------
      indices, distances: arrays of shape (n_samples, n_neighbors)
          The indices and distances sorted by increasing distance.
      """
      for i in numba.prange(indices.shape[0]):
          # starting from the end of the array and moving back
          for j in range(indices.shape[1] - 1, 0, -1):
              indices[i, 0], indices[i, j] = (
                  indices[i, j],
                  indices[i, 0],
              )
              distances[i, 0], distances[i, j] = (
                  distances[i, j],
                  distances[i, 0],
              )
  
              siftdown(distances[i, :j], indices[i, :j], 0)
  
      return indices, distances
  
imports: import time
  import numba
  from numba.core import types
  import numba.experimental.structref
  import numpy
label_desc: Use image node_id 11 for calling a global function with example usage: deheap_sort(indices, distances) and returns: indices,  distances