code: def gen_sampling_table(self):
      table_size = 1e8
      power = 0.75
      numNodes = self.node_size
  
      print("Pre-procesing for non-uniform negative sampling!")
      node_degree = np.zeros(numNodes)  # out degree
  
      look_up = self.g.look_up_dict
      for edge in self.g.G.edges():
          node_degree[look_up[edge[0]]] += self.g.G[edge[0]][edge[1]][
              "weight"
          ]
  
      norm = sum(
          [math.pow(node_degree[i], power) for i in range(numNodes)]
      )
  
      self.sampling_table = np.zeros(int(table_size), dtype=np.uint32)
  
      p = 0
      i = 0
      for j in range(numNodes):
          p += float(math.pow(node_degree[j], power)) / norm
          while i < table_size and float(i) / table_size < p:
              self.sampling_table[i] = j
              i += 1
  
      data_size = self.g.G.number_of_edges()
      self.edge_alias = np.zeros(data_size, dtype=np.int32)
      self.edge_prob = np.zeros(data_size, dtype=np.float32)
      large_block = np.zeros(data_size, dtype=np.int32)
      small_block = np.zeros(data_size, dtype=np.int32)
  
      total_sum = sum(
          [
              self.g.G[edge[0]][edge[1]]["weight"]
              for edge in self.g.G.edges()
          ]
      )
      norm_prob = [
          self.g.G[edge[0]][edge[1]]["weight"] * data_size / total_sum
          for edge in self.g.G.edges()
      ]
      num_small_block = 0
      num_large_block = 0
      cur_small_block = 0
      cur_large_block = 0
      for k in range(data_size - 1, -1, -1):
          if norm_prob[k] < 1:
              small_block[num_small_block] = k
              num_small_block += 1
          else:
              large_block[num_large_block] = k
              num_large_block += 1
      while num_small_block and num_large_block:
          num_small_block -= 1
          cur_small_block = small_block[num_small_block]
          num_large_block -= 1
          cur_large_block = large_block[num_large_block]
          self.edge_prob[cur_small_block] = norm_prob[cur_small_block]
          self.edge_alias[cur_small_block] = cur_large_block
          norm_prob[cur_large_block] = (
              norm_prob[cur_large_block]
              + norm_prob[cur_small_block]
              - 1
          )
          if norm_prob[cur_large_block] < 1:
              small_block[num_small_block] = cur_large_block
              num_small_block += 1
          else:
              large_block[num_large_block] = cur_large_block
              num_large_block += 1
  
      while num_large_block:
          num_large_block -= 1
          self.edge_prob[large_block[num_large_block]] = 1
      while num_small_block:
          num_small_block -= 1
          self.edge_prob[small_block[num_small_block]] = 1
  
imports: from __future__ import print_function
  import random
  import math
  import numpy
  from sklearn.linear_model import LogisticRegression
  import tensorflow
  from .classify import Classifier, read_node_label
label_desc: Use image node_id 5 for calling the _LINE obj's underlying member method code with example usage: obj.gen_sampling_table() without return types