code: def deepwalk_generator(
      graph,
      batch_size=512,
      walk_len=5,
      win_size=2,
      neg_num=5,
      epoch=200,
      filelist=None,
  ):
      def walks_generator():
          if filelist is not None:
              bucket = []
              for filename in filelist:
                  with io.open(filename) as inf:
                      for line in inf:
                          walk = [
                              int(x)
                              for x in line.strip("\n").split(" ")
                          ]
                          bucket.append(walk)
                          if len(bucket) == batch_size:
                              yield bucket
                              bucket = []
              if len(bucket):
                  yield bucket
          else:
              for _ in range(epoch):
                  for nodes in graph.node_batch_iter(batch_size):
                      walks = graph.random_walk(nodes, walk_len)
                      yield walks
  
      def wrapper():
          for walks in walks_generator():
              src, pos = gen_pair(walks, win_size, win_size)
              if src.shape[0] == 0:
                  continue
              negs = graph.sample_nodes([len(src), neg_num, 1]).astype(
                  np.int64
              )
              yield [src, pos, negs]
  
      return wrapper
  
imports: import argparse
  import time
  import math
  import os
  import io
  from multiprocessing import Pool
  import glob
  import numpy
  import sklearn.metrics
  from sklearn.metrics import f1_score
  import pgl
  from pgl import data_loader
  from pgl.utils import op
  from pgl.utils.logger import log
  import paddle.fluid
  import paddle.fluid.layers
label_desc: Use image node_id 4 for calling a global function with example usage: deepwalk_generator(graph, batch_size, walk_len, win_size, neg_num, epoch, filelist) and returns: wrapper