code: def read_binary_heterograph_raw(raw_dir, add_inverse_edge=False):
      """
      raw_dir: path to the raw directory
      add_inverse_edge (bool): whether to add inverse edge or not
  
      return: graph_list, which is a list of heterogeneous graphs.
      Each graph is a dictionary, containing the following keys:
      - edge_index_dict
          edge_index_dict[(head, rel, tail)] = edge_index for (head, rel, tail)
  
      - edge_feat_dict
          edge_feat_dict[(head, rel, tail)] = edge_feat for (head, rel, tail)
  
      - node_feat_dict
          node_feat_dict[nodetype] = node_feat for nodetype
  
      - num_nodes_dict
          num_nodes_dict[nodetype] = num_nodes for nodetype
  
      * edge_feat_dict and node_feat_dict are optional: if a graph does not contain it, we will simply have None.
  
      We can also have additional node/edge features. For example,
      - edge_**
      - node_**
  
      """
  
      if add_inverse_edge:
          raise RuntimeError(
              "add_inverse_edge is depreciated in read_binary"
          )
  
      print("Loading necessary files...")
      print("This might take a while.")
  
      # loading necessary files
      try:
          num_nodes_dict = read_npz_dict(
              osp.join(raw_dir, "num_nodes_dict.npz")
          )
          tmp = read_npz_dict(osp.join(raw_dir, "num_edges_dict.npz"))
          num_edges_dict = {
              tuple(key.split("___")): tmp[key] for key in tmp.keys()
          }
          del tmp
          tmp = read_npz_dict(osp.join(raw_dir, "edge_index_dict.npz"))
          edge_index_dict = {
              tuple(key.split("___")): tmp[key] for key in tmp.keys()
          }
          del tmp
  
          ent_type_list = sorted(list(num_nodes_dict.keys()))
          triplet_type_list = sorted(list(num_edges_dict.keys()))
  
          num_graphs = len(num_nodes_dict[ent_type_list[0]])
  
      except FileNotFoundError:
          raise RuntimeError("No necessary file")
  
      # storing node and edge features
      # mapping from the name of the features to feat_dict
      node_feat_dict_dict = {}
      edge_feat_dict_dict = {}
  
      for filename in os.listdir(raw_dir):
          if ".npz" not in filename:
              continue
          if filename in [
              "num_nodes_dict.npz",
              "num_edges_dict.npz",
              "edge_index_dict.npz",
          ]:
              continue
  
          # do not read target label information here
          if "-label.npz" in filename:
              continue
  
          feat_name = filename.split(".")[0]
  
          if "node_" in feat_name:
              feat_dict = read_npz_dict(osp.join(raw_dir, filename))
              node_feat_dict_dict[feat_name] = feat_dict
          elif "edge_" in feat_name:
              tmp = read_npz_dict(osp.join(raw_dir, filename))
              feat_dict = {
                  tuple(key.split("___")): tmp[key]
                  for key in tmp.keys()
              }
              del tmp
              edge_feat_dict_dict[feat_name] = feat_dict
          else:
              raise RuntimeError(
                  f"Keys in graph object should start from either 'node_' or 'edge_', but found '{feat_name}'."
              )
  
      graph_list = []
      num_nodes_accum_dict = {ent_type: 0 for ent_type in ent_type_list}
      num_edges_accum_dict = {
          triplet: 0 for triplet in triplet_type_list
      }
  
      print("Processing graphs...")
      for i in tqdm(range(num_graphs)):
          graph = dict()
  
          ### set up default atribute
          graph["edge_index_dict"] = {}
          graph["num_nodes_dict"] = {}
  
          for feat_name in node_feat_dict_dict.keys():
              graph[feat_name] = {}
  
          for feat_name in edge_feat_dict_dict.keys():
              graph[feat_name] = {}
  
          if not "edge_feat_dict" in graph:
              graph["edge_feat_dict"] = None
  
          if not "node_feat_dict" in graph:
              graph["node_feat_dict"] = None
  
          ### handling edge
          for triplet in triplet_type_list:
              edge_index = edge_index_dict[triplet]
              num_edges = num_edges_dict[triplet][i]
              num_edges_accum = num_edges_accum_dict[triplet]
  
              ### add edge_index
              graph["edge_index_dict"][triplet] = edge_index[
                  :, num_edges_accum : num_edges_accum + num_edges
              ]
  
              ### add edge feature
              for feat_name in edge_feat_dict_dict.keys():
                  if triplet in edge_feat_dict_dict[feat_name]:
                      feat = edge_feat_dict_dict[feat_name][triplet]
                      graph[feat_name][triplet] = feat[
                          num_edges_accum : num_edges_accum + num_edges
                      ]
  
              num_edges_accum_dict[triplet] += num_edges
  
          ### handling node
          for ent_type in ent_type_list:
              num_nodes = num_nodes_dict[ent_type][i]
              num_nodes_accum = num_nodes_accum_dict[ent_type]
  
              ### add node feature
              for feat_name in node_feat_dict_dict.keys():
                  if ent_type in node_feat_dict_dict[feat_name]:
                      feat = node_feat_dict_dict[feat_name][ent_type]
                      graph[feat_name][ent_type] = feat[
                          num_nodes_accum : num_nodes_accum + num_nodes
                      ]
  
              graph["num_nodes_dict"][ent_type] = num_nodes
              num_nodes_accum_dict[ent_type] += num_nodes
  
          graph_list.append(graph)
  
      return graph_list
  
file_path: ogb/ogb/io/read_graph_raw.py
imports: import pandas
  import os.path
  import os
  import numpy
  from ogb.utils.url import decide_download, download_url, extract_zip
  from tqdm.auto import tqdm
label_desc: Use image node_id 4 for calling a global function with example usage: read_binary_heterograph_raw(raw_dir, add_inverse_edge) and returns: graph_list