class_docstr: The data load just read the edge file, at the same time reindex the source and destination.
class_docstr_tok: ["The","data","load","just","read","the","edge","file",",","at","the","same","time","reindex","the","source","and","destination","."]
code: def _load_edge_data(self):
      node_sets = set()
      edges = []
      with open(self._data_dir, "r") as f:
          node_dict = dict()
          for line in f:
              src, dist = [
                  int(data) for data in line.strip("\n\r").split(" ")
              ]
              if src not in node_dict:
                  node_dict[src] = len(node_dict) + 1
              src = node_dict[src]
              if dist not in node_dict:
                  node_dict[dist] = len(node_dict) + 1
              dist = node_dict[dist]
              node_sets.add(src)
              node_sets.add(dist)
              edges.append((src, dist))
              if self._undirected:
                  edges.append((dist, src))
  
      num_nodes = len(node_sets)
      self.graph = graph.Graph(num_nodes=num_nodes + 1, edges=edges)
      self.nodes = np.array(list(node_sets))
      self.node_dict = node_dict
  
imports: from pgl import graph
  import numpy
label_desc: Use image node_id 2 for calling the EdgeDataset obj's underlying member method code with example usage: obj._load_edge_data() without return types