code: def walk(args):
      graph = build_graph(args.num_nodes, args.edge_path)
      num_sample_workers = args.num_sample_workers
  
      if args.train_files is None or args.train_files == "None":
          log.info("Walking from graph...")
          train_files = [None for _ in range(num_sample_workers)]
      else:
          log.info("Walking from train_data...")
          files = get_file_list(args.train_files)
          train_files = [[] for i in range(num_sample_workers)]
          for idx, f in enumerate(files):
              train_files[idx % num_sample_workers].append(f)
  
      def walk_to_file(walk_gen, filename, max_num):
          with open(filename, "w") as outf:
              num = 0
              for walks in walk_gen:
                  for walk in walks:
                      outf.write(
                          "%s\n" % "\t".join([str(i) for i in walk])
                      )
                      num += 1
                      if num % 1000 == 0:
                          log.info(
                              "Total: %s, %s walkpath is saved. "
                              % (max_num, num)
                          )
                      if num == max_num:
                          return
  
      m_args = [
          (
              DeepwalkReader(
                  graph,
                  batch_size=args.batch_size,
                  walk_len=args.walk_len,
                  win_size=args.win_size,
                  neg_num=args.neg_num,
                  neg_sample_type=args.neg_sample_type,
                  walkpath_files=None,
                  train_files=train_files[i],
              ).walk_generator(),
              "%s/%s" % (args.walkpath_files, i),
              args.epoch * args.num_nodes // args.num_sample_workers,
          )
          for i in range(num_sample_workers)
      ]
      ps = []
      for i in range(num_sample_workers):
          p = Process(target=walk_to_file, args=m_args[i])
          p.start()
          ps.append(p)
      for i in range(num_sample_workers):
          ps[i].join()
  
imports: import argparse
  import time
  import os
  import math
  from multiprocessing import Process
  import numpy
  import paddle.fluid
  import paddle.fluid.layers
  from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
  from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import StrategyFactory
  import paddle.fluid.incubate.fleet.base.role_maker
  import pgl
  from pgl.utils.logger import log
  from pgl import data_loader
  from reader import DeepwalkReader
  from model import DeepwalkModel
  from utils import get_file_list
  from utils import build_graph
  from utils import build_random_graph
  from utils import build_fake_graph
  from utils import build_gen_func
label_desc: Use image node_id 5 for calling a global function with example usage: walk(args) without return types