code: def merge_nodes(self, partition, consider_comms=None):
      
      if (consider_comms is None):
        consider_comms = self.consider_comms
      diff =  _c_leiden._Optimiser_merge_nodes(self._optimiser, partition._partition, consider_comms)
      partition._update_internal_membership()
      return diff
docs: Merge nodes for *optimising* the partition.
  
      Parameters
      ----------
      partition
        The partition for which to merge nodes.
  
      consider_comms
        If ``None`` uses :attr:`consider_comms`, but can be set to
        something else.
  
      Returns
      -------
      float
        Improvement in quality function.
  
      Notes
      -----
      This function loop over all nodes once and tries to merge them with another
      community.  Merging in this case implies that a node will never be removed
      from a community, only merged with other communities.
  
      See Also
      --------
      :func:`Optimiser.move_nodes`
  
      :func:`Optimiser.merge_nodes_constrained`
  
      Examples
      --------
      >>> G = ig.Graph.Famous('Zachary')
      >>> optimiser = la.Optimiser()
      >>> partition = la.ModularityVertexPartition(G)
      >>> diff = optimiser.merge_nodes(partition)