code: def ConstructGraph(edges, n_entities, args):
      """Construct Graph for training
  
      Parameters
      ----------
      edges : (heads, rels, tails) triple
          Edge list
      n_entities : int
          number of entities
      args :
          Global configs.
      """
      if args.has_edge_importance:
          src, etype_id, dst, e_impts = edges
      else:
          src, etype_id, dst = edges
      coo = sp.sparse.coo_matrix(
          (np.ones(len(src)), (src, dst)),
          shape=[n_entities, n_entities],
      )
      g = dgl.DGLGraph(
          coo, readonly=True, multigraph=True, sort_csr=True
      )
      g.edata["tid"] = F.tensor(etype_id, F.int64)
      if args.has_edge_importance:
          g.edata["impts"] = F.tensor(e_impts, F.float32)
      return g
  
imports: import math
  import numpy
  import scipy
  import dgl.backend
  import dgl
  import os
  import sys
  import pickle
  import time
  from dgl.base import NID, EID
  import pdb
label_desc: Use image node_id 4 for calling a global function with example usage: ConstructGraph(edges, n_entities, args) and returns: g