code: def compute_edges_list(A, kth=9):
      # Get k-similar neighbor indices for each node.
      num_nodes = A.shape[0]
      new_kth = num_nodes - kth
  
      if num_nodes > kth:
          knns = np.argpartition(A, new_kth - 1, axis=-1)[:, new_kth:-1]
          knn_values = np.partition(A, new_kth - 1, axis=-1)[
              :, new_kth:-1
          ]
      else:
          # Handling for graphs with less than kth nodes.
          # In such cases, the resulting graph will be fully connected.
          knns = np.tile(np.arange(num_nodes), num_nodes).reshape(
              num_nodes, num_nodes
          )
          knn_values = A
  
          # Removing self loop.
          if num_nodes != 1:
              knn_values = A[
                  knns != np.arange(num_nodes)[:, None]
              ].reshape(num_nodes, -1)
              knns = knns[
                  knns != np.arange(num_nodes)[:, None]
              ].reshape(num_nodes, -1)
      return knns, knn_values
  
imports: import os
  import pickle
  import numpy
  from scipy.spatial.distance import cdist
  from tqdm import tqdm
  from ..None import backend
  from ..convert import graph
  from .dgl_dataset import DGLDataset
  from .utils import download, extract_archive, load_graphs, save_graphs, Subset
label_desc: Use image node_id 3 for calling a global function with example usage: compute_edges_list(A, kth) and returns: knns,  knn_values