code: def main(config):
      conf_id2index, conf_name2index, conf_node_type = remapping_id(
          os.path.join(config.data_path, "id_conf.txt"),
          start_index=0,
          node_type="c",
      )
      log.info("%d venues have been loaded." % (len(conf_id2index)))
  
      (
          author_id2index,
          author_name2index,
          author_node_type,
      ) = remapping_id(
          os.path.join(config.data_path, "id_author.txt"),
          start_index=len(conf_id2index),
          node_type="a",
      )
      log.info("%d authors have been loaded." % (len(author_id2index)))
  
      paper_id2index, paper_name2index, paper_node_type = remapping_id(
          os.path.join(config.data_path, "paper.txt"),
          start_index=(len(conf_id2index) + len(author_id2index)),
          node_type="p",
          separator="\t",
      )
      log.info("%d papers have been loaded." % (len(paper_id2index)))
  
      node_types = conf_node_type + author_node_type + paper_node_type
  
      paper2author_edges = load_edges(
          os.path.join(config.data_path, "paper_author.txt"),
          paper_id2index,
          author_id2index,
      )
      log.info(
          "%d paper2author edges have been loaded."
          % (len(paper2author_edges))
      )
  
      paper2conf_edges = load_edges(
          os.path.join(config.data_path, "paper_conf.txt"),
          paper_id2index,
          conf_id2index,
      )
      log.info(
          "%d paper2conf edges have been loaded."
          % (len(paper2conf_edges))
      )
  
      author_label = load_label(
          config.author_label_file, author_name2index
      )
      conf_label = load_label(config.venue_label_file, conf_name2index)
  
      make_dir(config.processed_path)
      node_types_file = os.path.join(
          config.processed_path, "node_types.txt"
      )
      log.info("saving node_types to %s" % node_types_file)
      with open(node_types_file, "w") as writer:
          for item in tqdm.tqdm(node_types):
              writer.write("%s\t%s\n" % (item[1], item[0]))
  
      p2a_edges_file = os.path.join(
          config.processed_path, "paper2author_edges.txt"
      )
      log.info("saving paper2author edges to %s" % p2a_edges_file)
      with open(p2a_edges_file, "w") as writer:
          for item in tqdm.tqdm(paper2author_edges):
              writer.write("\t".join(item) + "\n")
  
      p2c_edges_file = os.path.join(
          config.processed_path, "paper2conf_edges.txt"
      )
      log.info("saving paper2conf edges to %s" % p2c_edges_file)
      with open(p2c_edges_file, "w") as writer:
          for item in tqdm.tqdm(paper2conf_edges):
              writer.write("\t".join(item) + "\n")
  
      author_label_file = os.path.join(
          config.processed_path, "author_label.txt"
      )
      log.info("saving author label to %s" % author_label_file)
      with open(author_label_file, "w") as writer:
          for item in tqdm.tqdm(author_label):
              writer.write("\t".join(item) + "\n")
  
      conf_label_file = os.path.join(
          config.processed_path, "conf_label.txt"
      )
      log.info("saving conf label to %s" % conf_label_file)
      with open(conf_label_file, "w") as writer:
          for item in tqdm.tqdm(conf_label):
              writer.write("\t".join(item) + "\n")
  
file_path: PGL/examples/metapath2vec/data_preprocess.py
imports: import os
  import sys
  import tqdm
  import time
  import logging
  import random
  import argparse
  import numpy
  import pickle
  from pgl.utils.logger import log
  from utils.config import prepare_config, make_dir
label_desc: Use image node_id 4 for calling a global function with example usage: main(config) without return types