code: def make_multihop_edges(gdata, k):
      gdata = copy.deepcopy(gdata)
      num_nodes = gdata["num_nodes"]
  
      multihop_edges = []
  
      # distance 0: self loop means distance == 0
      hop0_edges = np.arange(0, num_nodes, dtype="int64").reshape(-1, 1)
      hop0_edges = np.repeat(hop0_edges, 2, axis=1)
  
      src = hop0_edges[:, 0]
      dst = hop0_edges[:, 1]
      value = np.zeros(shape=(len(src),))
      A0 = csr_matrix((value, (src, dst)), shape=(num_nodes, num_nodes))
  
      # distance 1:
      hop1_edges = np.array(gdata["edges"])
      if len(hop1_edges.shape) != 2:
          return (None, None, None)
  
      src = hop1_edges[:, 0]
      dst = hop1_edges[:, 1]
      value = np.ones(shape=(len(src),)) * 2
      A1 = csr_matrix((value, (src, dst)), shape=(num_nodes, num_nodes))
  
      Ad = A1
      Ads = [A0, A1]
      for d in range(2, k + 1):
          Ad = csr_matrix.dot(Ad, A1) + A1
          coo_Ad = Ad.tocoo()
          row = coo_Ad.row
          col = coo_Ad.col
          value = np.ones(shape=(len(row),)) * (1 << d)
          Ad = csr_matrix(
              (value, (row, col)), shape=(num_nodes, num_nodes)
          )
          Ads.append(Ad)
  
      for d in range(len(Ads) - 1, 0, -1):
          # d and d-1
          A = Ads[d] + Ads[d - 1]
          A = A.tocoo()
          d_idx = ((A.data / (1 << d)) % 2 == 1) & (
              (A.data / (1 << (d - 1))) % 2 != 1
          )
          d_row = A.row[d_idx]
          d_col = A.col[d_idx]
          e = np.stack((d_row, d_col)).T
          multihop_edges.append(e)
  
      multihop_edges.append(
          hop0_edges
      )  # distance 0, not necessary to minimum, append directly.
  
      multihop_edges.reverse()
      multihop_edges[1] = hop1_edges
      gdata["mh_edges"] = multihop_edges
      main_graph = pgl.Graph(
          num_nodes=gdata["num_nodes"],
          edges=gdata["edges"],
          node_feat={"feat": gdata["nfeat"]},
          edge_feat={"feat": gdata["efeat"]},
      )
  
      graph_list = []
      for d in range(k + 1):
          g = pgl.Graph(
              num_nodes=gdata["num_nodes"], edges=multihop_edges[d]
          )
          graph_list.append(g)
  
      return (main_graph, graph_list, gdata["label"])
  
imports: import os
  import sys
  import json
  import numpy
  import glob
  import copy
  import time
  import argparse
  from collections import OrderedDict, namedtuple
  from scipy.sparse import csr_matrix
  from ogb.graphproppred import GraphPropPredDataset
  from ogb.utils.features import get_atom_feature_dims, get_bond_feature_dims
  import pgl
  import paddle
  from pgl.utils.data.dataset import Dataset, StreamDataset, HadoopDataset
  from pgl.utils.data import Dataloader
  from pgl.utils.logger import log
  from utils.config import prepare_config, make_dir
label_desc: Use image node_id 1 for calling a global function with example usage: make_multihop_edges(gdata, k) and returns: main_graph,  graph_list,  gdata, None,  None,  None