code: def path_len(graph):
      """get networks for mini batch shortest path prediction tasks"""
      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(nx.all_pairs_shortest_path_length(graph.G))
      edge_label = []
      index_keep = []
      for i in range(num_label):
          start = edge_label_index[0, i].item()
          end = edge_label_index[1, i].item()
          try:
              dist = path_dict[start][end]
          except Exception:
              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 = edge_label_index[:, index_keep]
      graph.edge_label = edge_label
  
file_path: GraphGym/graphgym/models/transform.py
imports: import networkx
  import torch
  from torch_geometric.utils import negative_sampling
label_desc: Use image node_id 4 for calling a global function with example usage: path_len(graph) without return types