graph_cluster() clusters a compact fastEmbedR_graph with a native
multilevel Louvain implementation, a Leiden local-move/refine/aggregate
implementation, or the Pons-Latapy Walktrap algorithm. Louvain and Leiden
have CPU, CUDA, and Metal implementations. Walktrap is CPU-only. No Python,
igraph, cuGraph, or external clustering function is called at run time.
Usage
graph_cluster(
graph,
method = c("leiden", "louvain", "walktrap"),
backend = NULL,
resolution = 1,
n_iterations = 10L,
n_runs = 1L,
steps = 4L,
seed = 1L
)Arguments
- graph
A
fastEmbedR_graph, or an edge-list list containingfrom,to,weight, andn_vertices.- method
"leiden","louvain", or"walktrap". Walktrap is the package's true random-walk community method.- backend
Execution backend.
"cuda"and"metal"are available for Louvain and Leiden only and fail explicitly if the requested accelerator was not compiled or is unavailable. They never fall back to CPU.- resolution
Positive modularity resolution for Louvain and Leiden. Walktrap uses its reference resolution of 1.
- n_iterations
Maximum local-moving passes for Louvain and Leiden.
- n_runs
Independent seeded Louvain/Leiden runs; the highest-modularity result is returned.
- steps
Random-walk length for Walktrap.
- seed
Reproducible random seed for Louvain and Leiden.
Value
A fastEmbedR_graph_cluster containing one-based membership,
modularity, method, implementation, and run metadata.
References
Blondel VD, Guillaume JL, Lambiotte R, Lefebvre E. Fast unfolding of communities in large networks. J Stat Mech. 2008;2008:P10008.
Traag VA, Waltman L, van Eck NJ. From Louvain to Leiden: guaranteeing well-connected communities. Sci Rep. 2019;9:5233.
Pons P, Latapy M. Computing communities in large networks using random walks. J Graph Algorithms Appl. 2006;10:191-218.