code: def add_edge(self, G, edge_element, edge_attr):
      # add an edge to the graph
  
      # raise error if we find mixed directed and undirected edges
      edge_direction = edge_element.get("type")
      if G.is_directed() and edge_direction == "undirected":
          raise nx.NetworkXError(
              "Undirected edge found in directed graph."
          )
      if (not G.is_directed()) and edge_direction == "directed":
          raise nx.NetworkXError(
              "Directed edge found in undirected graph."
          )
  
      # Get source and target and recast type if required
      source = edge_element.get("source")
      target = edge_element.get("target")
      if self.node_type is not None:
          source = self.node_type(source)
          target = self.node_type(target)
  
      data = self.decode_attr_elements(edge_attr, edge_element)
      data = self.add_start_end(data, edge_element)
  
      if self.VERSION == "1.1":
          data = self.add_slices(data, edge_element)  # add slices
      else:
          data = self.add_spells(data, edge_element)  # add spells
  
      # GEXF stores edge ids as an attribute
      # NetworkX uses them as keys in multigraphs
      # if networkx_key is not specified as an attribute
      edge_id = edge_element.get("id")
      if edge_id is not None:
          data["id"] = edge_id
  
      # check if there is a 'multigraph_key' and use that as edge_id
      multigraph_key = data.pop("networkx_key", None)
      if multigraph_key is not None:
          edge_id = multigraph_key
  
      weight = edge_element.get("weight")
      if weight is not None:
          data["weight"] = float(weight)
  
      edge_label = edge_element.get("label")
      if edge_label is not None:
          data["label"] = edge_label
  
      if G.has_edge(source, target):
          # seen this edge before - this is a multigraph
          self.simple_graph = False
      G.add_edge(source, target, key=edge_id, **data)
      if edge_direction == "mutual":
          G.add_edge(target, source, key=edge_id, **data)
  
imports: import itertools
  import time
  from xml.etree.ElementTree import Element, ElementTree, SubElement, register_namespace, tostring
  import networkx
  from networkx.utils import open_file
label_desc: Use image node_id 10 for calling the GEXFReader obj's underlying member method code with example usage: obj.add_edge(G, edge_element, edge_attr) without return types