
GPU-accelerated Leiden or Louvain community detection
leiden_clustering_gpu.RdGPU counterpart of bixverse::leiden_clustering(). The level-0 local
moving runs on the GPU; the coarser levels, the Leiden refinement and the
aggregation stay on the CPU. Graphs below 50,000 nodes, or with a node of
degree above 512, run fully on the CPU with coloured local moving, as the
kernel launches cost more than they save there. On one device the partition
depends on seed only, but it is not identical to the CPU result: the GPU
accepts moves with an order-free rule instead of the CPU's sequential
re-check. Communities are numbered by size, 1 being the largest.
Usage
leiden_clustering_gpu(
graph,
resolution = 1,
algorithm = c("leiden", "louvain"),
beta = 0.01,
n_iterations = NULL,
min_gain = 0,
local_moving = NULL,
node_order = NULL,
seed = 42L
)Arguments
- graph
SingleCellConnectivityor undirected igraph. For an igraph, the edge attributeweightis used if present, otherwise all edges get weight 1. An igraph is converted withbixverse::as_sc_connectivity()first.- resolution
Numeric. Modularity resolution parameter. Higher values give more communities.
- algorithm
String. One of
c("leiden", "louvain").- beta
Numeric. Randomness of the Leiden refinement merges. Ignored for Louvain.
- n_iterations
Optional integer. Number of full iterations, each starting from the previous partition. A negative value iterates until the partition is stable. If
NULL, the bixverse default foralgorithm.- min_gain
Numeric. With a negative
n_iterations, also stop once an iteration gains no more than this in modularity.- local_moving
Optional string. One of
c("queue", "coloured"). Applies to the coarser levels only; level 0 always runs the coloured moves on the GPU.NULLis"queue"for Leiden and"coloured"for Louvain.- node_order
Optional string. One of
c("bfs", "shuffle"). Visit order of the queue on the coarser levels,"bfs"(sweep in BFS order from a random start) or"shuffle"(as igraph).NULLis"bfs"for Leiden and"shuffle"for Louvain.- seed
Integer. Random seed.