code: def knns2ordered_nbrs(knns, sort=True):
      if isinstance(knns, list):
          knns = np.array(knns)
      nbrs = knns[:, 0, :].astype(np.int32)
      dists = knns[:, 1, :]
      if sort:
          # sort dists from low to high
          nb_idx = np.argsort(dists, axis=1)
          idxs = np.arange(nb_idx.shape[0]).reshape(-1, 1)
          dists = dists[idxs, nb_idx]
          nbrs = nbrs[idxs, nb_idx]
      return dists, nbrs
  
file_path: dgl/examples/pytorch/hilander/utils/knn.py
imports: import math
  import multiprocessing
  import os
  import numpy
  from tqdm import tqdm
  from utils import Timer
  from .faiss_search import faiss_search_knn
label_desc: Use image node_id 1 for calling a global function with example usage: knns2ordered_nbrs(knns, sort) and returns: dists,  nbrs