tgs_graph_cover: Clusters directed graph

View source: R/knn.R

tgs_graph_coverR Documentation

Clusters directed graph

Description

Clusters directed graph.

Usage

tgs_graph_cover(graph, min_cluster_size, cooling = 1.05, burn_in = 10)

Arguments

graph

directed graph in the format returned by tgs_graph

min_cluster_size

used to determine the candidates for seeding (= min weight)

cooling

factor that is used to gradually increase the chance of a node to stay in the cluster

burn_in

number of node reassignments after which cooling is applied

Details

The algorithm is explained in a "MetaCell: analysis of single-cell RNA-seq data using K-nn graph partitions" paper, published in "Genome Biology" #20: https://genomebiology.biomedcentral.com/articles/10.1186/s13059-019-1812-2

Value

Data frame that maps each node to its cluster.

See Also

tgs_graph()

Examples


# Note: all the available CPU cores might be used

set.seed(seed = 0)
rows <- 100
cols <- 1000
vals <- sample(1:(rows * cols / 2), rows * cols, replace = TRUE)
m <- matrix(vals, nrow = rows, ncol = cols)
m[sample(1:(rows * cols), rows * cols / 1000)] <- NA

r1 <- tgs_cor(m, pairwise.complete.obs = FALSE, spearman = TRUE)
r2 <- tgs_knn(r1, knn = 30, diag = FALSE)
r3 <- tgs_graph(r2, knn = 3, k_expand = 10)
r4 <- tgs_graph_cover(r3, 5)





tgstat documentation built on July 9, 2023, 6:06 p.m.