run_motif_clustering: Run motif-based clustering

Description Usage Arguments Value Examples

View source: R/clustering.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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:

Examples

1
2
adj_mat <- matrix(c(1:9), nrow = 3)
run_motif_clustering(adj_mat, "M1", "func")

Example output

$adj_mat
     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9

$motif_adj_mat
3 x 3 sparse Matrix of class "dgCMatrix"
          
[1,] . 2 2
[2,] 2 . 2
[3,] 2 2 .

$comps
[1] 1 2 3

$adj_mat_comps
3 x 3 sparse Matrix of class "dgCMatrix"
          
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9

$motif_adj_mat_comps
3 x 3 sparse Matrix of class "dgCMatrix"
          
[1,] . 2 2
[2,] 2 . 2
[3,] 2 2 .

$vals
[1] 4.440892e-15 6.000000e+00

$vects
          [,1]       [,2]
[1,] 0.5773503  0.0000000
[2,] 0.5773503 -0.7071068
[3,] 0.5773503  0.7071068

$clusts
[1] 1 2 1

motifcluster documentation built on Nov. 15, 2021, 9:06 a.m.