code: def testAddEdge(self):
      graph = {}
      self.assertTrue(graph_utils.add_edge(graph, ["A", "B", "0.5"]))
      # The next 3 calls test that the edge with maximal weight is used.
      self.assertTrue(graph_utils.add_edge(graph, ["A", "C", 0.7]))
      self.assertFalse(graph_utils.add_edge(graph, ["A", "C", 0.9]))
      self.assertFalse(graph_utils.add_edge(graph, ["A", "C", 0.8]))
      self.assertTrue(graph_utils.add_edge(graph, ("B", "A", "0.4")))
      # Tests that when no weight is specified, it defaults to 1.0.
      self.assertTrue(graph_utils.add_edge(graph, ("B", "C")))
      self.assertTrue(graph_utils.add_edge(graph, ("D", "A", 0.75)))
      self.assertDictEqual(graph, GRAPH)
  
file_path: neural-structured-learning/neural_structured_learning/tools/graph_utils_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  from absl.testing import absltest
  from neural_structured_learning.tools import graph_utils
label_desc: Use image node_id 1 for calling the GraphUtilsTest obj's underlying member method code with example usage: obj.testAddEdge() without return types