run_motif_clustering: Run motif-based clustering

View source: R/clustering.R

run_motif_clusteringR Documentation

Run motif-based clustering

Description

Run motif-based clustering on the adjacency matrix of a (weighted directed) network, using a specified motif, motif type, weighting scheme, embedding dimension, number of clusters and Laplacian type.

Usage

run_motif_clustering(
  adj_mat,
  motif_name,
  motif_type = c("struc", "func"),
  mam_weight_type = c("unweighted", "mean", "product"),
  mam_method = c("sparse", "dense"),
  num_eigs = 2,
  type_lap = c("comb", "rw"),
  restrict = TRUE,
  num_clusts = 2
)

Arguments

adj_mat

Adjacency matrix to be embedded.

motif_name

Motif used for the motif adjacency matrix.

motif_type

Type of motif adjacency matrix to use. One of "func" or "struc".

mam_weight_type

Weighting scheme for the motif adjacency matrix. One of "unweighted", "mean" or "product".

mam_method

The method to use for building the motif adjacency matrix. One of "sparse" or "dense".

num_eigs

Number of eigenvalues and eigenvectors for the embedding.

type_lap

Type of Laplacian for the embedding. One of "comb" or "rw".

restrict

Whether or not to restrict the motif adjacency matrix to its largest connected component before embedding.

num_clusts

The number of clusters to find.

Value

A list with 8 entries:

  • adj_mat: the original adjacency matrix.

  • motif_adj_mat: the motif adjacency matrix.

  • comps: the indices of the largest connected component of the motif adjacency matrix (if restrict = TRUE).

  • adj_mat_comps: the original adjacency matrix restricted to the largest connected component of the motif adjacency matrix (if restrict = TRUE).

  • motif_adj_mat_comps: the motif adjacency matrix restricted to its largest connected component (if restrict = TRUE).

  • vals: a length-num_eigs vector containing the eigenvalues associated with the Laplace embedding of the (restricted) motif adjacency matrix.

  • vects: a matrix containing the eigenvectors associated with the Laplace embedding of the (restricted) motif adjacency matrix.

  • clusts: a vector containing integers representing the cluster assignment of each vertex in the (restricted) graph.

Examples

adj_mat <- matrix(c(1:16), nrow = 4)
run_motif_clustering(adj_mat, "M1", "func")

motifcluster documentation built on Nov. 18, 2022, 9:06 a.m.