def find_partition(graph, partition_type, initial_membership=None, weights=None, **kwargs):
if not weights is None:<EOL><INDENT>kwargs['<STR_LIT>'] = weights<EOL><DEDENT>partition = partition_type(graph,<EOL>initial_membership=initial_membership,<EOL>**kwargs)<EOL>optimiser = Optimiser()<EOL>optimiser.optimise_partition(partition)<EOL>return partition<EOL>
Detect communities using the default settings.

    This function detects communities given the specified method in the
    ``partition_type``. This should be type derived from
    :class:`VertexPartition.MutableVertexPartition`, e.g.
    :class:`ModularityVertexPartition` or :class:`CPMVertexPartition`. Optionally
    an initial membership and edge weights can be provided. Remaining
    ``**kwargs`` are passed on to the constructor of the ``partition_type``,
    including for example a ``resolution_parameter``.

    Parameters
    ----------
    graph : :class:`ig.Graph`
      The graph for which to detect communities.

    partition_type : type of :class:`
      The type of partition to use for optimisation.

    initial_membership : list of int
      Initial membership for the partition. If :obj:`None` then defaults to a
      singleton partition.

    weights : list of double, or edge attribute
      Weights of edges. Can be either an iterable or an edge attribute.

    **kwargs
      Remaining keyword arguments, passed on to constructor of
      ``partition_type``.

    Returns
    -------
    partition
      The optimised partition.

    See Also
    --------
    :func:`Optimiser.optimise_partition`

    Examples
    --------
    >>> G = ig.Graph.Famous('Zachary')
    >>> partition = louvain.find_partition(G, louvain.ModularityVertexPartition)