class_docstr: Generate positive and negative samples
  Attributes:
      g(dgl.DGLGraph): graph
      split_edge(dict): split edge
      neg_samples(int): num of negative samples per positive sample
      subsample_ratio(float): ratio of subsample
      shuffle(bool): if shuffle generated graph list
class_docstr_tok: ["Generate","positive","and","negative","samples","Attributes",":","g","(","dgl.DGLGraph",")",":","graph","split_edge","(","dict",")",":","split","edge","neg_samples","(","int",")",":","num","of","negative","samples","per","positive","sample","subsample_ratio","(","float",")",":","ratio","of","subsample","shuffle","(","bool",")",":","if","shuffle","generated","graph","list"]
code: def __call__(self, split_type):
      if split_type == "train":
          subsample_ratio = self.subsample_ratio
      else:
          subsample_ratio = 1
  
      pos_edges = self.split_edge[split_type]["edge"]
      if split_type == "train":
          # Adding self loop in train avoids sampling the source node itself.
          g = add_self_loop(self.g)
          eids = g.edge_ids(pos_edges[:, 0], pos_edges[:, 1])
          neg_edges = torch.stack(self.neg_sampler(g, eids), dim=1)
      else:
          neg_edges = self.split_edge[split_type]["edge_neg"]
      pos_edges = self.subsample(pos_edges, subsample_ratio).long()
      neg_edges = self.subsample(neg_edges, subsample_ratio).long()
  
      edges = torch.cat([pos_edges, neg_edges])
      labels = torch.cat(
          [
              torch.ones(pos_edges.size(0), 1),
              torch.zeros(neg_edges.size(0), 1),
          ]
      )
      if self.shuffle:
          perm = torch.randperm(edges.size(0))
          edges = edges[perm]
          labels = labels[perm]
      return edges, labels
  
imports: import os.path
  from copy import deepcopy
  import dgl
  import torch
  from dgl import add_self_loop, DGLGraph, NID
  from dgl.dataloading.negative_sampler import Uniform
  from torch.utils.data import DataLoader, Dataset
  from tqdm import tqdm
  from utils import drnl_node_labeling
label_desc: Use image node_id 2 for calling the PosNegEdgesGenerator obj's underlying member method code with example usage: obj.__call__(split_type) and returns: edges,  labels