code: def negative_sample(self, src, pos, neg_num, neg_sample_type):
      if neg_sample_type == "average":
          neg_sample_size = [len(pos), neg_num, 1]
          negs = np.random.randint(
              low=0, high=self.graph.num_nodes, size=neg_sample_size
          )
  
      elif neg_sample_type == "m2v_plus":
          negs = []
          for s in src:
              neg = self.graph.sample_nodes(
                  sample_num=neg_num, n_type=self.graph.node_types[s]
              )
              negs.append(neg)
          negs = np.vstack(negs).reshape(-1, neg_num, 1)
  
      else:  # equal to "average"
          neg_sample_size = [len(pos), neg_num, 1]
          negs = np.random.randint(
              low=0, high=self.graph.num_nodes, size=neg_sample_size
          )
  
      negs = negs.astype(np.int64)
  
      return negs
  
imports: from __future__ import division
  from __future__ import absolute_import
  from __future__ import print_function
  import time
  import io
  import os
  import numpy
  import random
  from pgl.utils.logger import log
  from pgl.sample import metapath_randomwalk
  from pgl.graph_kernel import skip_gram_gen_pair
  from pgl.graph_kernel import alias_sample_build_table
  from utils import load_config
  from graph import m2vGraph
  import mp_reader
label_desc: Use image node_id 4 for calling the DataGenerator obj's underlying member method code with example usage: obj.negative_sample(src, pos, neg_num, neg_sample_type) and returns: negs