code: def get_nearst_node(pos, batch):
      j, i = knn_graph(pos, 1, batch)
      adj_nearest = SparseTensor(
          row=i,
          col=j,
          value=torch.ones_like(j, device=j.device),
          sparse_sizes=(batch.size(0), batch.size(0)),
      )
      j2, i2 = knn_graph(pos, 2, batch)
      adj_nearest2 = SparseTensor(
          row=i2,
          col=j2,
          value=torch.ones_like(j2, device=j2.device),
          sparse_sizes=(batch.size(0), batch.size(0)),
      )
  
      return adj_nearest, SparseTensor.from_dense(
          adj_nearest2.to_dense() - adj_nearest.to_dense()
      )
  
file_path: DIG/dig/ggraph3D/method/G_SphereNet/model/geometric_computing.py
imports: import torch
  from torch_scatter import scatter
  from torch_sparse import SparseTensor
  from math import sqrt, pi
  from torch_geometric.nn import knn_graph
label_desc: Use image node_id 1 for calling a global function with example usage: get_nearst_node(pos, batch) and returns: adj_nearest,  SparseTensor