code: def batch_iter(self, node2idx):
      edges = [
          (node2idx[x[0]], node2idx[x[1]]) for x in self.graph.edges()
      ]
  
      data_size = self.graph.number_of_edges()
      shuffle_indices = np.random.permutation(np.arange(data_size))
      # positive or negative mod
      mod = 0
      mod_size = 1 + self.negative_ratio
      h = []
      t = []
      sign = 0
      count = 0
      start_index = 0
      end_index = min(start_index + self.batch_size, data_size)
      while True:
          if mod == 0:
              h = []
              t = []
              for i in range(start_index, end_index):
                  if (
                      random.random()
                      >= self.edge_accept[shuffle_indices[i]]
                  ):
                      shuffle_indices[i] = self.edge_alias[
                          shuffle_indices[i]
                      ]
                  cur_h = edges[shuffle_indices[i]][0]
                  cur_t = edges[shuffle_indices[i]][1]
                  h.append(cur_h)
                  t.append(cur_t)
              sign = np.ones(len(h))
          else:
              sign = np.ones(len(h)) * -1
              t = []
              for i in range(len(h)):
                  t.append(
                      alias_sample(self.node_accept, self.node_alias)
                  )
  
          if self.order == "all":
              yield ([np.array(h), np.array(t)], [sign, sign])
          else:
              yield ([np.array(h), np.array(t)], [sign])
          mod += 1
          mod %= mod_size
          if mod == 0:
              start_index = end_index
              end_index = min(start_index + self.batch_size, data_size)
  
          if start_index >= data_size:
              count += 1
              mod = 0
              h = []
              shuffle_indices = np.random.permutation(
                  np.arange(data_size)
              )
              start_index = 0
              end_index = min(start_index + self.batch_size, data_size)
  
file_path: GraphEmbedding/ge/models/line.py
imports: import math
  import random
  import numpy
  from deepctr.layers.utils import reduce_sum
  from tensorflow.python.keras import backend
  from tensorflow.python.keras.layers import Embedding, Input, Lambda
  from tensorflow.python.keras.models import Model
  from ..alias import create_alias_table, alias_sample
  from ..utils import preprocess_nxgraph
label_desc: Use image node_id 5 for calling the LINE obj's underlying member method code with example usage: obj.batch_iter(node2idx) without return types