code: def _add_graph_level(
      graph,
      level,
      parent_ids,
      names,
      scores,
      normalized_scores,
      include_pad,
  ):
      """Adds a level to the passed graph"""
      for i, parent_id in enumerate(parent_ids):
          if not include_pad and names[i] == PAD_TOKEN:
              continue
          new_node = (level, i)
          parent_node = (level - 1, parent_id)
          raw_score = (
              "%.3f" % float(scores[i])
              if scores[i] is not None
              else "-inf"
          )
          norm_score = (
              "%.3f" % float(normalized_scores[i])
              if normalized_scores[i] is not None
              else "-inf"
          )
  
          graph.add_node(new_node)
          graph.node[new_node]["name"] = names[i]
          graph.node[new_node]["score"] = "[RAW] {}".format(raw_score)
          graph.node[new_node]["norm_score"] = "[NORM] {}".format(
              norm_score
          )
          graph.node[new_node]["size"] = 100
          # Add an edge to the parent
          graph.add_edge(parent_node, new_node)
  
file_path: sockeye/sockeye_contrib/vistools/generate_graphs.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import argparse
  import os
  import json
  import shutil
  from string import Template
  import networkx
  from networkx.readwrite import json_graph
label_desc: Use image node_id 1 for calling a global function with example usage: _add_graph_level(graph, level, parent_ids, names, scores, normalized_scores, include_pad) without return types