code: def _community_leiden(
      graph,
      objective_function="CPM",
      weights=None,
      resolution=1.0,
      beta=0.01,
      initial_membership=None,
      n_iterations=2,
      node_weights=None,
      **kwds,
  ):
      """Finds the community structure of the graph using the Leiden
      algorithm of Traag, van Eck & Waltman.
  
      B{Reference}: Traag, V. A., Waltman, L., & van Eck, N. J. (2019). From Louvain
      to Leiden: guaranteeing well-connected communities. I{Scientific Reports},
      9(1), 5233. doi: 10.1038/s41598-019-41695-z
  
      @param objective_function: whether to use the Constant Potts
        Model (CPM) or modularity. Must be either C{"CPM"} or C{"modularity"}.
      @param weights: edge weights to be used. Can be a sequence or
        iterable or even an edge attribute name.
      @param resolution: the resolution parameter to use. Higher resolutions
        lead to more smaller communities, while lower resolutions lead to fewer
        larger communities.
      @param beta: parameter affecting the randomness in the Leiden
        algorithm. This affects only the refinement step of the algorithm.
      @param initial_membership: if provided, the Leiden algorithm
        will try to improve this provided membership. If no argument is
        provided, the aglorithm simply starts from the singleton partition.
      @param n_iterations: the number of iterations to iterate the Leiden
        algorithm. Each iteration may improve the partition further. Using
        a negative number of iterations will run until a stable iteration is
        encountered (i.e. the quality was not increased during that
        iteration).
      @param node_weights: the node weights used in the Leiden algorithm.
        If this is not provided, it will be automatically determined on the
        basis of whether you want to use CPM or modularity. If you do provide
        this, please make sure that you understand what you are doing.
      @return: an appropriate L{VertexClustering} object with an extra attribute
        called C{quality} that stores the value of the internal quality function
        optimized by the algorithm.
      """
      if objective_function.lower() not in ("cpm", "modularity"):
          raise ValueError(
              'objective_function must be "CPM" or "modularity".'
          )
  
      if "resolution_parameter" in kwds:
          deprecated(
              "resolution_parameter keyword argument is deprecated, use "
              "resolution=... instead"
          )
          resolution = kwds.pop("resolution_parameter")
  
      if kwds:
          raise TypeError("unexpected keyword argument")
  
      membership, quality = GraphBase.community_leiden(
          graph,
          edge_weights=weights,
          node_weights=node_weights,
          resolution=resolution,
          normalize_resolution=(objective_function == "modularity"),
          beta=beta,
          initial_membership=initial_membership,
          n_iterations=n_iterations,
      )
  
      params = {"quality": quality}
  
      modularity_params = {"resolution": resolution}
      if weights is not None:
          modularity_params["weights"] = weights
  
      return VertexClustering(
          graph,
          membership,
          params=params,
          modularity_params=modularity_params,
      )
  
file_path: python-igraph/src/igraph/community.py
imports: from igraph._igraph import GraphBase
  from igraph.clustering import VertexDendrogram, VertexClustering
  from igraph.utils import deprecated
  from typing import List, Sequence, Tuple
label_desc: Use image node_id 11 for calling a global function with example usage: _community_leiden(graph, objective_function, weights, resolution, beta, initial_membership, n_iterations, node_weights) and returns: VertexClustering