code: def add_edge(i, j, g):
      """
      Adds an edge i --> j to the graph, g. The edge is only
      added if this addition does NOT cause the graph to have
      cycles.
      """
      g.add_edges_from([(i, j, {})])
      if is_directed_acyclic_graph(g) is False:
          g.remove_edge(i, j)
  
imports: import re
  from queue import LifoQueue
  import networkx
  import numpy
  from networkx.algorithms.dag import is_directed_acyclic_graph
  from networkx.algorithms.shortest_paths.generic import shortest_path
  from dowhy.utils.ordered_set import OrderedSet
label_desc: Use image node_id 14 for calling a global function with example usage: add_edge(i, j, g) without return types