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"]
docstr: Subsample generated edges.
  Args:
      edges(Tensor): edges to subsample
      subsample_ratio(float): ratio of subsample
  
  Returns:
      edges(Tensor):  edges
docstr_tok: ["Subsample","generated","edges",".","Args",":","edges","(","Tensor",")",":","edges","to","subsample","subsample_ratio","(","float",")",":","ratio","of","subsample","Returns",":","edges","(","Tensor",")",":","edges"]
code: def subsample(self, edges, subsample_ratio):
      """
      Subsample generated edges.
      Args:
          edges(Tensor): edges to subsample
          subsample_ratio(float): ratio of subsample
  
      Returns:
          edges(Tensor):  edges
  
      """
  
      num_edges = edges.size(0)
      perm = torch.randperm(num_edges)
      perm = perm[: int(subsample_ratio * num_edges)]
      edges = edges[perm]
      return edges
  
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 3 for calling the PosNegEdgesGenerator obj's underlying member method code with example usage: obj.subsample(edges, subsample_ratio) and returns: edges