R igraph manual pages

Use this if you are using igraph from R

Finding community structure of a graph using the Leiden algorithm of Traag, van Eck & Waltman.

Description

Finding community structure of a graph using the Leiden algorithm of Traag, van Eck & Waltman.

Usage

cluster_leiden(
  graph,
  objective_function = c("CPM", "modularity"),
  weights = NULL,
  resolution_parameter = 1,
  beta = 0.01,
  initial_membership = NULL,
  n_iterations = 2,
  vertex_weights = NULL
)

Arguments

graph

The input graph, only undirected graphs are supported.

objective_function

Whether to use the Constant Potts Model (CPM) or modularity. Must be either "CPM" or "modularity".

weights

The weights of the edges. It must be a positive numeric vector, NULL or NA. If it is NULL and the input graph has a ‘weight’ edge attribute, then that attribute will be used. If NULL and no such attribute is present, then the edges will have equal weights. Set this to NA if the graph was a ‘weight’ edge attribute, but you don't want to use it for community detection. A larger edge weight means a stronger connection for this function.

resolution_parameter

The resolution parameter to use. Higher resolutions lead to more smaller communities, while lower resolutions lead to fewer larger communities.

beta

Parameter affecting the randomness in the Leiden algorithm. This affects only the refinement step of the algorithm.

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.

n_iterations

the number of iterations to iterate the Leiden algorithm. Each iteration may improve the partition further.

vertex_weights

the vertex 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.

Value

cluster_leiden returns a communities object, please see the communities manual page for details.

Author(s)

Vincent Traag

References

Traag, V. A., Waltman, L., & van Eck, N. J. (2019). From Louvain to Leiden: guaranteeing well-connected communities. Scientific reports, 9(1), 5233. doi: 10.1038/s41598-019-41695-z

See Also

See communities for extracting the membership, modularity scores, etc. from the results.

Other community detection algorithms: cluster_walktrap, cluster_spinglass, cluster_leading_eigen, cluster_edge_betweenness, cluster_fast_greedy, cluster_label_prop cluster_louvain

Examples

g <- graph.famous("Zachary")
# By default CPM is used
g <- cluster_leiden(g, resolution_parameter=0.06)


[Package igraph version 1.3.0 Index]