NNGraphParam-class: Graph-based clustering

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Run community detection algorithms on a nearest-neighbor (NN) graph within clusterRows.

Usage

1
2
3
4
5
6
7
8
9
NNGraphParam(
  shared = TRUE,
  ...,
  cluster.fun = "walktrap",
  cluster.args = list()
)

## S4 method for signature 'ANY,NNGraphParam'
clusterRows(x, BLUSPARAM, full = FALSE)

Arguments

shared

Logical scalar indicating whether a shared NN graph should be constructed.

...

Further arguments to pass to makeSNNGraph (if shared=TRUE) or makeKNNGraph.

cluster.fun

Function specifying the method to use to detect communities in the NN graph. The first argument of this function should be the NN graph and the return value should be a communities object.

Alternatively, this may be a string containing the suffix of any igraph community detection algorithm. For example, cluster.fun="louvain" will instruct clusterRows to use cluster_louvain. Defaults to cluster_walktrap.

cluster.args

Further arguments to pass to the chosen cluster.fun.

x

A numeric matrix-like object where rows represent observations and columns represent variables.

BLUSPARAM

A NNGraphParam object.

full

Logical scalar indicating whether the graph-based clustering objects should be returned.

Details

To modify an existing NNGraphParam object x, users can simply call x[[i]] or x[[i]] <- value where i is any argument used in the constructor.

Value

The NNGraphParam constructor will return a NNGraphParam object with the specified parameters.

The clusterRows method will return a factor of length equal to nrow(x) containing the cluster assignments. If full=TRUE, a list is returned with clusters (the factor, as above) and objects; the latter is a list with graph (the graph) and communities (the output of cluster.fun).

Author(s)

Aaron Lun

See Also

makeSNNGraph and related functions, to build the graph.

cluster_walktrap and related functions, to perform community detection.

Examples

1
2
3
clusterRows(iris[,1:4], NNGraphParam())
clusterRows(iris[,1:4], NNGraphParam(k=5))
clusterRows(iris[,1:4], NNGraphParam(cluster.fun="louvain"))

bluster documentation built on Nov. 8, 2020, 8:29 p.m.