code: def _bipartite_projection(
      graph, types="type", multiplicity=True, probe1=-1, which="both"
  ):
      """Projects a bipartite graph into two one-mode graphs. Edge directions
      are ignored while projecting.
  
      Examples:
  
      >>> g = Graph.Full_Bipartite(10, 5)
      >>> g1, g2 = g.bipartite_projection()
      >>> g1.isomorphic(Graph.Full(10))
      True
      >>> g2.isomorphic(Graph.Full(5))
      True
  
      @param types: an igraph vector containing the vertex types, or an
        attribute name. Anything that evalulates to C{False} corresponds to
        vertices of the first kind, everything else to the second kind.
      @param multiplicity: if C{True}, then igraph keeps the multiplicity of
        the edges in the projection in an edge attribute called C{"weight"}.
        E.g., if there is an A-C-B and an A-D-B triplet in the bipartite
        graph and there is no other X (apart from X=B and X=D) for which an
        A-X-B triplet would exist in the bipartite graph, the multiplicity
        of the A-B edge in the projection will be 2.
      @param probe1: this argument can be used to specify the order of the
        projections in the resulting list. If given and non-negative, then
        it is considered as a vertex ID; the projection containing the
        vertex will be the first one in the result.
      @param which: this argument can be used to specify which of the two
        projections should be returned if only one of them is needed. Passing
        0 here means that only the first projection is returned, while 1 means
        that only the second projection is returned. (Note that we use 0 and 1
        because Python indexing is zero-based). C{False} is equivalent to 0 and
        C{True} is equivalent to 1. Any other value means that both projections
        will be returned in a tuple.
      @return: a tuple containing the two projected one-mode graphs if C{which}
        is not 1 or 2, or the projected one-mode graph specified by the
        C{which} argument if its value is 0, 1, C{False} or C{True}.
      """
      # Deferred import to avoid cycles
      from igraph import Graph
  
      superclass_meth = super(Graph, graph).bipartite_projection
  
      if which is False:
          which = 0
      elif which is True:
          which = 1
      if which != 0 and which != 1:
          which = -1
  
      if multiplicity:
          if which == 0:
              g1, w1 = superclass_meth(types, True, probe1, which)
              g2, w2 = None, None
          elif which == 1:
              g1, w1 = None, None
              g2, w2 = superclass_meth(types, True, probe1, which)
          else:
              g1, g2, w1, w2 = superclass_meth(
                  types, True, probe1, which
              )
  
          if g1 is not None:
              g1.es["weight"] = w1
              if g2 is not None:
                  g2.es["weight"] = w2
                  return g1, g2
              else:
                  return g1
          else:
              g2.es["weight"] = w2
              return g2
      else:
          return superclass_meth(types, False, probe1, which)
  
imports: from igraph._igraph import GraphBase
  from igraph.matching import Matching
label_desc: Use image node_id 2 for calling a global function with example usage: _bipartite_projection(graph, types, multiplicity, probe1, which) and returns: superclass_meth, g2, g1,  g2, g1