code: def build_train_graph(
      g, train_indices, utype, itype, etype, etype_rev
  ):
      train_g = g.edge_subgraph(
          {etype: train_indices, etype_rev: train_indices},
          relabel_nodes=False,
      )
  
      # copy features
      for ntype in g.ntypes:
          for col, data in g.nodes[ntype].data.items():
              train_g.nodes[ntype].data[col] = data
      for etype in g.etypes:
          for col, data in g.edges[etype].data.items():
              train_g.edges[etype].data[col] = data[
                  train_g.edges[etype].data[dgl.EID]
              ]
  
      return train_g
  
file_path: dgl/examples/pytorch/pinsage/data_utils.py
imports: import dask.dataframe
  import dgl
  import numpy
  import scipy.sparse
  import torch
  import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: build_train_graph(g, train_indices, utype, itype, etype, etype_rev) and returns: train_g