class_docstr: Computes the similarity graph from a set of (dense) embeddings.
docstr: Reads embeddings and writes the similarity graph to `output_graph_path`.
  
  The parameters used to construct the graph are taken from the
  `nsl.configs.GraphBuilderConfig` passed to this class's constructor.
  
  Args:
    embedding_files: A list of names of TFRecord files containing
      `tf.train.Example` objects, which in turn contain dense embeddings.
    output_graph_path: Name of the file to which the output graph in TSV
      format should be written.
docstr_tok: ["Reads","embeddings","and","writes","the","similarity","graph","to","`","output_graph_path","`",".","The","parameters","used","to","construct","the","graph","are","taken","from","the","`","nsl.configs.GraphBuilderConfig","`","passed","to","this","class","'s","constructor",".","Args",":","embedding_files",":","A","list","of","names","of","TFRecord","files","containing","`","tf.train.Example","`","objects",",","which","in","turn","contain","dense","embeddings",".","output_graph_path",":","Name","of","the","file","to","which","the","output","graph","in","TSV","format","should","be","written","."]
code: def build(self, embedding_files, output_graph_path):
      """Reads embeddings and writes the similarity graph to `output_graph_path`.
  
      The parameters used to construct the graph are taken from the
      `nsl.configs.GraphBuilderConfig` passed to this class's constructor.
  
      Args:
        embedding_files: A list of names of TFRecord files containing
          `tf.train.Example` objects, which in turn contain dense embeddings.
        output_graph_path: Name of the file to which the output graph in TSV
          format should be written.
      """
      embeddings = _read_tfrecord_examples(
          embedding_files,
          self.config.id_feature_name,
          self.config.embedding_feature_name,
      )
      start_time = time.time()
      logging.info(
          "Building graph and writing edges to TSV file: %s",
          output_graph_path,
      )
      np.random.seed(self.config.random_seed)
      logging.info(
          "Using random seed value: %s", self.config.random_seed
      )
      edge_cnt = 0
      with open(output_graph_path, "w") as f:
          for src, tgt, wt in self._generate_edges(embeddings):
              f.write("%s\t%s\t%f\n" % (src, tgt, wt))
              f.write("%s\t%s\t%f\n" % (tgt, src, wt))
              edge_cnt += 1
          logging.info(
              "Wrote graph containing %d bi-directional edges (%.2f seconds).",
              edge_cnt,
              time.time() - start_time,
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  import time
  from absl import app
  from absl import flags
  from absl import logging
  import neural_structured_learning.configs
  import numpy
  import six
  import tensorflow
label_desc: Use image node_id 7 for calling the GraphBuilder obj's underlying member method code with example usage: obj.build(embedding_files, output_graph_path) without return types