code: def _add_edge(graph, source, target, **kwds):
      """Adds a single edge to the graph.
  
      Keyword arguments (except the source and target arguments) will be
      assigned to the edge as attributes.
  
      The performance cost of adding a single edge or several edges
      to a graph is similar. Thus, when adding several edges, a single
      C{add_edges()} call is more efficient than multiple C{add_edge()} calls.
  
      @param source: the source vertex of the edge or its name.
      @param target: the target vertex of the edge or its name.
  
      @return: the newly added edge as an L{Edge} object. Use
          C{add_edges([(source, target)])} if you don't need the L{Edge}
          object and want to avoid the overhead of creating it.
      """
      eid = graph.ecount()
      graph.add_edges([(source, target)])
      edge = graph.es[eid]
      for key, value in kwds.items():
          edge[key] = value
      return edge
  
file_path: python-igraph/src/igraph/basic.py
imports: from igraph._igraph import GraphBase
  from igraph.seq import EdgeSeq
  from igraph.utils import deprecated
label_desc: Use image node_id 1 for calling a global function with example usage: _add_edge(graph, source, target) and returns: edge