code: def get_graph_nbrhd(train_graph, ent, exclude_tuple):
      """Helper to get neighbor entities excluding a particular tuple."""
      es, er, et = exclude_tuple
      neighborhood = [
          nbr
          for nbr in train_graph.kg_data[ent]
          if ent != es or nbr != et or
          # er not in train_graph.kg_data[ent][nbr]]
          (train_graph.kg_data[ent][nbr] - set([er]))
      ]
      if train_graph.add_reverse_graph:
          rev_nighborhood = [
              nbr
              for nbr in train_graph.reverse_kg_data[ent]
              if ent != et or nbr != es or
              # er not in train_graph.reverse_kg_data[ent][nbr]]
              (train_graph.reverse_kg_data[ent][nbr] - set([er]))
          ]
          neighborhood += rev_nighborhood
      neighborhood = np.array(list(set(neighborhood)), dtype=int)
      return neighborhood
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import clueweb_text_graph
  import numpy
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: get_graph_nbrhd(train_graph, ent, exclude_tuple) and returns: neighborhood