Learn R Programming

RaceID (version 0.3.9)

graphCluster: Function for infering clustering of the pruned k nearest neighbour graph

Description

This function derives a graph object from the pruned k nearest neighbours and infers clusters by modularity optimizatio nusing the Louvain or the Leiden algorithm on this graph. A Fruchterman-Rheingold graph layout is also derived from the pruned nearest neighbours.

Usage

graphCluster(
  res,
  pvalue = 0.01,
  use.weights = TRUE,
  use.leiden = FALSE,
  leiden.resolution = 1,
  min.size = 2,
  rseed = 12345
)

Value

List object of three components:

partition

Vector with clustering partition.

fr

Data.frame with Fruchterman-Rheingold graph layout.

residual.cluster

In case clusters with less than min.size elements occur in the cluster partition, these are grouped into a common cluster, to which the largest cluster number is assigned. If this grouping was done, the cluster number is given by this value. Otherwise, the value of this object is NULL.

Arguments

res

List object with k nearest neighbour information returned by pruneKnn function.

pvalue

Positive real number between 0 and 1. All nearest neighbours with link probability < pvalue are discarded. Default is 0.01.

use.weights

logical. If TRUE, then nearest-neighbor link probabilities are used to build a graph as input for Louvain clustering. If FALSE, then all links have equal weight. Default is TRUE.

use.leiden

logical. If TRUE, then the Leiden algorithm is used. If FALSE, the Louvain algorithm is used. Default is FALSE.

leiden.resolution

Positive real number. Resolution parameter for the Leiden algorithm.

min.size

Positive integer number. Minimum cluster size. All clusters with less than min.size elements are aggregated into one cluster, to which the largest cluster number is assigned. See output value residual.cluster. Default value is 2.

rseed

Integer number. Random seed to enforce reproducible clustering results. Default is 12345.

Examples

Run this code
res <- pruneKnn(intestinalDataSmall,knn=10,alpha=1,no_cores=1,FSelect=FALSE)
cl <- graphCluster(res,pvalue=0.01)

Run the code above in your browser using DataLab