code: def get_neighbor_list_fb_wn(data_path):
      with open(os.path.join(data_path, "entities.dict")) as fin:
          entity2id = dict()
          for line in fin:
              eid, entity = line.strip().split("\t")
              entity2id[entity] = int(eid)
  
      with open(os.path.join(data_path, "relations.dict")) as fin:
          relation2id = dict()
          for line in fin:
              rid, relation = line.strip().split("\t")
              relation2id[relation] = int(rid)
  
      with open(os.path.join(data_path, "train.txt")) as fin:
          edges = []
          for line in fin:
              h, r, t = line.strip().split("\t")
              hid = entity2id[h]
              rid = relation2id[r]
              tid = entity2id[t]
              edges.append([hid, rid, tid])
          edges = np.array(edges, dtype=np.int32)
  
      n_entities = len(entity2id)
      entity_neighbors = []
      for eid in range(n_entities):
          nb = [[], [], []]
          h_index = np.where(edges[:, 0] == eid)
          nb[0].extend(list(edges[h_index[0]][:, 2]))
          nb[1].extend(list(edges[h_index[0]][:, 1]))
          nb[2].extend([-1] * len(h_index[0]))
          t_index = np.where(edges[:, 2] == eid)
          nb[0].extend(list(edges[t_index[0]][:, 0]))
          nb[1].extend(list(edges[t_index[0]][:, 1]))
          nb[2].extend([1] * len(t_index[0]))
          entity_neighbors.append(nb)
      return entity_neighbors, edges
  
file_path: PGL/apps/Graph4KG/examples/REP/rep.py
imports: import os
  import time
  import logging
  import argparse
  import numpy
  from tqdm import tqdm
  import pgl
  from ote_orth import OrthOTE
label_desc: Use image node_id 2 for calling a global function with example usage: get_neighbor_list_fb_wn(data_path) and returns: entity_neighbors,  edges