code: def path_len(graph, netlib=None, **kwargs):
      if netlib is None:
          import networkx as netlib
  
      n = graph.num_nodes
      # shortest path label
      num_label = 1000
      edge_label_index = torch.randint(
          n, size=(2, num_label), device=graph.edge_index.device
      )
      path_dict = dict(netlib.all_pairs_shortest_path_length(graph.G))
      edge_label = []
      index_keep = []
      for i in range(num_label):
          start, end = (
              edge_label_index[0, i].item(),
              edge_label_index[1, i].item(),
          )
          try:
              dist = path_dict[start][end]
          except:
              continue
          edge_label.append(min(dist, 4))
          index_keep.append(i)
  
      edge_label = torch.tensor(
          edge_label, device=edge_label_index.device
      )
      graph.edge_label_index, graph.edge_label = (
          edge_label_index[:, index_keep],
          edge_label,
      )
  
file_path: deepsnap/examples/graph_classification/transforms.py
imports: import random
  import torch
  import numpy
  import time
  import pdb
label_desc: Use image node_id 3 for calling a global function with example usage: path_len(graph, netlib) without return types