code: def __getitem__(self, i):
      eids = self.pos_sampler.sample()
      src, dst = self.g.find_edges(eids)
      src, dst = src.numpy(), dst.numpy()
      rel = self.g.edata[dgl.ETYPE][eids].numpy()
  
      # relabel nodes to have consecutive node IDs
      uniq_v, edges = np.unique((src, dst), return_inverse=True)
      num_nodes = len(uniq_v)
      # edges is the concatenation of src, dst with relabeled ID
      src, dst = np.reshape(edges, (2, -1))
      relabeled_data = np.stack((src, rel, dst)).transpose()
  
      samples, labels = self.neg_sampler.sample(
          relabeled_data, num_nodes
      )
  
      # use only half of the positive edges
      chosen_ids = np.random.choice(
          np.arange(self.sample_size),
          size=int(self.sample_size / 2),
          replace=False,
      )
      src = src[chosen_ids]
      dst = dst[chosen_ids]
      rel = rel[chosen_ids]
      src, dst = np.concatenate((src, dst)), np.concatenate((dst, src))
      rel = np.concatenate((rel, rel + self.num_rels))
      sub_g = dgl.graph((src, dst), num_nodes=num_nodes)
      sub_g.edata[dgl.ETYPE] = torch.from_numpy(rel)
      sub_g.edata["norm"] = dgl.norm_by_dst(sub_g).unsqueeze(-1)
      uniq_v = torch.from_numpy(uniq_v).view(-1).long()
  
      return sub_g, uniq_v, samples, labels
  
imports: import dgl
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import tqdm
  from dgl.data.knowledge_graph import FB15k237Dataset
  from dgl.dataloading import GraphDataLoader
  from dgl.nn.pytorch import RelGraphConv
label_desc: Use image node_id 3 for calling the SubgraphIterator obj's underlying member method code with example usage: obj.__getitem__(i) and returns: sub_g,  uniq_v,  samples,  labels