code: def add_path(G, data, one_way):
      
  
      # extract the ordered list of nodes from this path element, then delete it
      # so we don't add it as an attribute to the edge later
      path_nodes = data['nodes']
      del data['nodes']
  
      # set the oneway attribute to the passed-in value, to make it consistent
      # True/False values
      data['oneway'] = one_way
  
      # zip together the path nodes so you get tuples like (0,1), (1,2), (2,3)
      # and so on
      path_edges = list(zip(path_nodes[:-1], path_nodes[1:]))
      G.add_edges_from(path_edges, **data)
  
      # if the path is NOT one-way
      if not one_way:
          # reverse the direction of each edge and add this path going the
          # opposite direction
          path_edges_opposite_direction = [(v, u) for u, v in path_edges]
          G.add_edges_from(path_edges_opposite_direction, **data)
docs: Add a path to the graph.
  
      Parameters
      ----------
      G : networkx multidigraph
      data : dict
          the attributes of the path
      one_way : bool
          if this path is one-way or if it is bi-directional
  
      Returns
      -------
      None