code: def __init__(
      self,
      graph_wrapper=None,
      buf_size=1000,
      batch_size=128,
      num_workers=1,
      shuffle=True,
      phase="train",
  ):
      super(PPADataGenerator, self).__init__(
          buf_size=buf_size,
          num_workers=num_workers,
          batch_size=batch_size,
          shuffle=shuffle,
      )
  
      self.d_name = "ogbl-ppa"
      self.graph_wrapper = graph_wrapper
      dataset = LinkPropPredDataset(name=self.d_name)
      splitted_edge = dataset.get_edge_split()
      self.phase = phase
      graph = dataset[0]
      edges = graph["edge_index"].T
      # self.graph = pgl.graph.Graph(num_nodes=graph["num_nodes"],
      #       edges=edges,
      #       node_feat={"nfeat": graph["node_feat"],
      #             "node_id": np.arange(0, graph["num_nodes"], dtype="int64").reshape(-1, 1) })
  
      # self.graph.indegree()
      self.num_nodes = graph["num_nodes"]
      if self.phase == "train":
          edges = splitted_edge["train"]["edge"]
          labels = np.ones(len(edges))
      elif self.phase == "valid":
          # Compute the embedding for all the nodes
          pos_edges = splitted_edge["valid"]["edge"]
          neg_edges = splitted_edge["valid"]["edge_neg"]
          pos_labels = np.ones(len(pos_edges))
          neg_labels = np.zeros(len(neg_edges))
          edges = np.vstack([pos_edges, neg_edges])
          labels = pos_labels.tolist() + neg_labels.tolist()
      elif self.phase == "test":
          # Compute the embedding for all the nodes
          pos_edges = splitted_edge["test"]["edge"]
          neg_edges = splitted_edge["test"]["edge_neg"]
          pos_labels = np.ones(len(pos_edges))
          neg_labels = np.zeros(len(neg_edges))
          edges = np.vstack([pos_edges, neg_edges])
          labels = pos_labels.tolist() + neg_labels.tolist()
  
      self.line_examples = []
      Example = namedtuple("Example", ["src", "dst", "label"])
      for edge, label in zip(edges, labels):
          self.line_examples.append(
              Example(src=edge[0], dst=edge[1], label=label)
          )
      print("Phase", self.phase)
      print("Len Examples", len(self.line_examples))
  
file_path: PGL/ogb_examples/linkproppred/ogbl-ppa/dataloader/ogbl_ppa_dataloader.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from __future__ import absolute_import
  from dataloader.base_dataloader import BaseDataGenerator
  import ssl
  from ogb.linkproppred import LinkPropPredDataset
  from ogb.linkproppred import Evaluator
  import tqdm
  from collections import namedtuple
  import pgl
  import numpy
label_desc: Use image node_id 1 to create a new PPADataGenerator object from inherited base classes: BaseDataGenerator with example: obj = PPADataGenerator(graph_wrapper, buf_size, batch_size, num_workers, shuffle, phase)