code: def __add__(graph, other):
      """Copies the graph and extends the copy depending on the type of
      the other object given.
  
      @param other: if it is an integer, the copy is extended by the given
        number of vertices. If it is a string, the copy is extended by a
        single vertex whose C{name} attribute will be equal to the given
        string. If it is a tuple with two elements, the copy
        is extended by a single edge. If it is a list of tuples, the copy
        is extended by multiple edges. If it is a L{Graph}, a disjoint
        union is performed.
      """
      # Deferred import to avoid cycles
      from igraph import Graph
  
      if isinstance(other, (int, str)):
          g = graph.copy()
          g.add_vertices(other)
      elif isinstance(other, tuple) and len(other) == 2:
          g = graph.copy()
          g.add_edges([other])
      elif isinstance(other, list):
          if len(other) > 0:
              if isinstance(other[0], tuple):
                  g = graph.copy()
                  g.add_edges(other)
              elif isinstance(other[0], str):
                  g = graph.copy()
                  g.add_vertices(other)
              elif isinstance(other[0], Graph):
                  return graph.disjoint_union(other)
              else:
                  return NotImplemented
          else:
              return graph.copy()
  
      elif isinstance(other, Graph):
          return graph.disjoint_union(other)
      else:
          return NotImplemented
  
      return g
  
file_path: python-igraph/src/igraph/operators/methods.py
imports: from igraph._igraph import GraphBase, Vertex, Edge
  from igraph.seq import VertexSeq, EdgeSeq
  from igraph.operators.functions import disjoint_union, union, intersection
label_desc: Use image node_id 5 for calling a global function with example usage: __add__(graph, other) and returns: g, graph, graph, NotImplemented, graph, NotImplemented