code: def write_tsv_graph(filename, graph):
      """Writes the given `graph` to the file `filename` in TSV format.
  
      Args:
        filename: Name of the file to which TSV output is written. The TSV lines are
          written in the same form as the input expected by `read_tsv_graph()`.
        graph: A `dict` source_id -> (target_id -> weight) representing the graph.
  
      Returns:
        `None`. Instead, this has the side-effect or writing output to a file.
      """
      start_time = time.time()
      logging.info("Writing graph to TSV file: %s", filename)
      with open(filename, "w") as f:
          for s, t_dict in six.iteritems(graph):
              for t, w in six.iteritems(t_dict):
                  f.write("%s\t%s\t%f\n" % (s, t, w))
      logging.info(
          "Done writing graph to TSV file: %s (%.2f seconds).",
          filename,
          (time.time() - start_time),
      )
  
file_path: neural-structured-learning/neural_structured_learning/tools/graph_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import time
  from absl import logging
  import six
label_desc: Use image node_id 4 for calling a global function with example usage: write_tsv_graph(filename, graph) without return types