if (requireNamespace("igraph", quietly = TRUE)) {
g <- igraph::make_graph("Zachary")
# Standard Leiden
comm <- community_leiden(g)
# Higher resolution for more communities
comm2 <- community_leiden(g, resolution = 1.5)
# Modularity objective
comm3 <- community_leiden(g, objective_function = "modularity")
}
Run the code above in your browser using DataLab