code: def aggregate_partition(self, membership_partition=None):
      
      partition_agg = self._FromCPartition(_c_leiden._MutableVertexPartition_aggregate_partition(self._partition))
  
      if (not membership_partition is None):
        membership = partition_agg.membership
        for v in self.graph.vs:
          membership[self.membership[v.index]] = membership_partition.membership[v.index]
        partition_agg.set_membership(membership)
  
      return partition_agg
docs: Aggregate the graph according to the current partition and provide a
      default partition for it.
  
      The aggregated graph can then be found as a parameter of the partition
      ``partition.graph``.
  
      Notes
      -----
      This function contrasts to the function ``cluster_graph`` in igraph itself,
      which also provides the aggregate graph, but we may require setting
      the appropriate ``resolution_parameter``, ``weights`` and ``node_sizes``.
      In particular, this function also ensures that the quality defined on the
      aggregate partition is identical to the quality defined on the original
      partition.
  
      Examples
      --------
      >>> G = ig.Graph.Famous('Zachary')
      >>> partition = la.find_partition(G, la.ModularityVertexPartition)
      >>> aggregate_partition = partition.aggregate_partition(partition)
      >>> aggregate_graph = aggregate_partition.graph
      >>> aggregate_partition.quality() == partition.quality()
      True