cluster {speakeasyR}R Documentation

SpeakEasy 2 community detection

Description

Group nodes into communities.

Usage

cluster(
  graph,
  discard_transient = 3,
  independent_runs = 10,
  max_threads = 0,
  seed = 0,
  target_clusters = 0,
  target_partitions = 5,
  subcluster = 1,
  min_clust = 5,
  verbose = FALSE,
  is_directed = "detect"
)

Arguments

graph

A graph or adjacency matrix in a form that can be converted to matrix or Matrix::dgCMatrix using an as.matrix() coercion method. Accepted types include matrix, dgCMatrix, ngCMatrix, and igraph::graphs.

discard_transient

The number of partitions to discard before tracking.

independent_runs

How many runs SpeakEasy2 should perform.

max_threads

The maximum number of threads to use. By default this is the same as the number of independent runs. If max_threads is greater than or equal to the number of processing cores, all cores may run. If max_threads is less than the number of cores, at most max_threads cores will run.

seed

Random seed to use for reproducible results. SpeakEasy2 uses a different random number generator than R, but if the seed is not explicitly set, R's random number generator is used create one. Because of this, setting R's RNG will also cause reproducible results.

target_clusters

The number of random initial labels to use.

target_partitions

Number of partitions to find per independent run.

subcluster

Depth of clustering. If greater than 1, perform recursive clustering.

min_clust

Smallest clusters to recursively cluster. If subcluster not set to a value greater than 1, this has no effect.

verbose

Whether to provide additional information about the clustering or not.

is_directed

Whether the graph should be treated as directed or not. By default, if the graph is symmetric it is treated as undirected.

Value

A membership vector. If subclustering, returns a matrix with number of rows equal to the number of recursive clustering. Each row is the membership at different hierarchical scales, such that the last rows are the highest resolution.

Examples

if (require("igraph")) {
  graph <- igraph::graph.famous("zachary")
  membership <- cluster(graph, max_threads = 2)
}

[Package speakeasyR version 0.1.2 Index]