cpAlgorithm: Clique Percolation Community Detection

Description Usage Arguments Details Value Author(s) References Examples

View source: R/cpAlgorithm.R

Description

Function for clique percolation community detection algorithms for weighted and unweighted networks.

Usage

1
cpAlgorithm(W, k, method = c("unweighted", "weighted", "weighted.CFinder"), I)

Arguments

W

A qgraph object; see also qgraph

k

Clique size (number of nodes that should form a clique)

method

A string indicating the method to use ("unweighted", "weighted", or "weighted.CFinder"); see Details

I

Intensity threshold for weighted networks

Details

method = "unweighted" conducts clique percolation for unweighted networks as described in Palla et al. (2005). method = "weighted" conducts clique percolation for weighted graphs with inclusion of cliques if their Intensity is higher than the specified Intensity (I), which is the method described in Farkas et al. (2007). method = "weighted.CFinder" conducts clique percolation as in the CFinder program. The Intensity (I) threshold is applied twice, namely first to the Intensity of the cliques (as before) and then also to their k-1 overlap with other cliques (e.g., in the case of k = 3, it is applied to the edge that two cliques share).

For weighted networks, the absolute value of the edge weights is taken. Therefore, negative edges are treated like positive edges just like in the CFinder program. Thus, the Intensity threshold I can only be positive.

cpAlgorithm produces a solution for all networks, even if there are no communities or communities have no overlap. The respective output is empty in such cases.

Value

A list object with the following elements:

list.of.communities.numbers

list of communities with numbers as identifiers of nodes

list.of.communities.labels

list of communities with labels from qgraph object as identifiers of nodes

shared.nodes.numbers

vector with all nodes that belong to multiple communities with numbers as identifiers of nodes

shared.nodes.labels

vector with all nodes that belong to multiple communities with labels from qgraph object as identifiers of nodes

isolated.nodes.numbers

vector with all nodes that belong to no community with numbers as identifiers of nodes

isolated.nodes.labels

vector with all nodes that belong to no community with labels from qgraph object as identifiers of nodes

k

user-specified k

method

user-specified method

I

user-specified I (if method was "weighted" or "weighted.CFinder")

Author(s)

Jens Lange, lange.jens@outlook.com

References

Farkas, I., Abel, D., Palla, G., & Vicsek, T. (2007). Weighted network modules. New Journal of Physics, 9, 180-180. http://doi.org/10.1088/1367-2630/9/6/180

Palla, G., Derenyi, I., Farkas, I., & Vicsek, T. (2005). Uncovering the overlapping community structure of complex networks in nature and society. Nature, 435, 814-818. http://doi.org/10.1038/nature03607

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Example for unweighted networks

# create qgraph object
W <- matrix(c(0,1,1,1,0,0,0,0,
              0,0,1,1,0,0,0,0,
              0,0,0,0,0,0,0,0,
              0,0,0,0,1,1,1,0,
              0,0,0,0,0,1,1,0,
              0,0,0,0,0,0,1,0,
              0,0,0,0,0,0,0,1,
              0,0,0,0,0,0,0,0), nrow = 8, ncol = 8, byrow = TRUE)
W <- Matrix::forceSymmetric(W)
W <- qgraph::qgraph(W)

# run clique percolation for unweighted networks
results <- cpAlgorithm(W = W, k = 3, method = "unweighted")

## Example for weighted networks

# create qgraph object
W <- matrix(c(0,1,1,1,0,0,0,0,
              0,0,1,1,0,0,0,0,
              0,0,0,0,0,0,0,0,
              0,0,0,0,1,1,1,0,
              0,0,0,0,0,1,1,0,
              0,0,0,0,0,0,1,0,
              0,0,0,0,0,0,0,1,
              0,0,0,0,0,0,0,0), nrow = 8, ncol = 8, byrow = TRUE)
set.seed(4186)
rand_w <- stats::rnorm(length(which(W == 1)), mean = 0.3, sd = 0.1)
W[which(W == 1)] <- rand_w
W <- Matrix::forceSymmetric(W)
W <- qgraph::qgraph(W)

# run clique percolation for weighted networks
results <- cpAlgorithm(W = W, k = 3, method = "weighted", I = 0.1)

chr1swallace/FasterCliquePercolation documentation built on Dec. 19, 2021, 3:59 p.m.