code: def get_a_graph(dists_max, dists_argmax):
      src = []
      dst = []
      real_src = []
      real_dst = []
      edge_weight = []
      dists_max = dists_max.numpy()
      for i in range(dists_max.shape[0]):
          # Get unique closest anchor nodes for node i across all anchor sets
          tmp_dists_argmax, tmp_dists_argmax_idx = np.unique(
              dists_argmax[i, :], True
          )
          src.extend([i] * tmp_dists_argmax.shape[0])
          real_src.extend([i] * dists_argmax[i, :].shape[0])
          real_dst.extend(list(dists_argmax[i, :].numpy()))
          dst.extend(list(tmp_dists_argmax))
          edge_weight.extend(
              dists_max[i, tmp_dists_argmax_idx].tolist()
          )
      eid_dict = {
          (u, v): i for i, (u, v) in enumerate(list(zip(dst, src)))
      }
      anchor_eid = [
          eid_dict.get((u, v)) for u, v in zip(real_dst, real_src)
      ]
      g = (dst, src)
      return g, anchor_eid, edge_weight
  
imports: import multiprocessing
  import random
  from multiprocessing import get_context
  import networkx
  import numpy
  import torch
  from tqdm.auto import tqdm
label_desc: Use image node_id 14 for calling a global function with example usage: get_a_graph(dists_max, dists_argmax) and returns: g,  anchor_eid,  edge_weight