class_docstr: Read a knowledge graph to memory
class_docstr_tok: ["Read","a","knowledge","graph","to","memory"]
docstr: Helper to find neighbors statistics.
docstr_tok: ["Helper","to","find","neighbors","statistics","."]
code: def _max_neighbors(self):
      """Helper to find neighbors statistics."""
      max_nbrs = 0
      num_nbrs = []
      max_ent = None
      for e1 in self.kg_data:
          nbrs = set(self.kg_data[e1].keys())
          if self.add_reverse_graph:
              nbrs |= set(self.reverse_kg_data[e1].keys())
          if len(nbrs) > max_nbrs:
              max_nbrs = len(nbrs)
              max_ent = self.inverse_entity_vocab[e1]
          num_nbrs.append(len(nbrs))
      logging.info(
          "Average number of neighbors: %.2f +- %.2f",
          np.mean(num_nbrs),
          np.std(num_nbrs),
      )
      logging.info("Max neighbors %d of entity %s", max_nbrs, max_ent)
      return max_nbrs
  
file_path: neural-structured-learning/research/a2n/graph.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from collections import defaultdict
  import csv
  from absl import logging
  import numpy
label_desc: Use image node_id 4 for calling the Graph obj's underlying member method code with example usage: obj._max_neighbors() and returns: max_nbrs