code: def _add_graph_level(graph, level, parent_ids, names, scores):
      """Adds a levelto the passed graph"""
      for i, parent_id in enumerate(parent_ids):
          new_node = (level, i)
          parent_node = (level - 1, parent_id)
          graph.add_node(new_node)
          graph.node[new_node]["name"] = names[i]
          graph.node[new_node]["score"] = str(scores[i])
          graph.node[new_node]["size"] = 100
          # Add an edge to the parent
          graph.add_edge(parent_node, new_node)
  
file_path: seq2seq/bin/tools/generate_beam_viz.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 numpy
  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) without return types