clustcoef_auto(x, thresholdWS = 0, thresholdON = 0)
clustWS(x, thresholdWS=0)
clustZhang(x)
clustOnnela(x, thresholdON=0)
qgraph
object, an igraph
object, an adjacency matrix, a weight matrix and an edgelist, or a weighted edgelist.x
to compute the binary clustering coefficients clustWS
and signed_clustWS
. Edges with weights lower than thresholdWS
in absolute value are zeroed. For uclustOnnela
, edge of weights lower than thresholdON
in absolute value are excluded. The value thresholdON = 0
(i.e., no edge is excluded) is generally suggested aupper.tri
(see examples).clustWS
computes the clustering coefficient for unweighted networks introduced by Watts & Strogatz (1998) and the corresponding signed version (Costantini & Perugini, in press).
ClustZhang
computes the clustering coefficient for weighted networks introduced by Zhang & Horvath (2005) and the corresponding signed version (Costantini & Perugini, in press).
clustOnnela
computes the clustering coefficient for weighted networks introduced by Onnela et al. (2005) and the corresponding signed version (Costantini & Perugini, in press).
clustering_auto
automatically recognizes the kind of the input network x
(weighted vs. unweighted, signed vs. unsigned) and computes a subset of indices according to the kind of the network: signed indices are not computed for unsigned networks and weighted indices are not computed for unweighted networks. However the unsigned indices are computed for signed networks, by considering the absolute value of the weights, and the unweighted indices are computed for weighted networks, after a binarization according to the parameter thresholdWS
. clustering_auto
computes also the weighted clustering coefficient by Barrat et al. (2004), relying on function transitivity
from package igraph
.
For the computation of the local clustering coefficient, a node must have at least two neighbors: for nodes with less than two neighbors NaN
is returned.Costantini, G., Perugini, M. (in press), Generalization of Clustering Coefficients to Signed Correlation Networks
Langfelder, P., & Horvath, S. (2008). WGCNA: an R package for weighted correlation network analysis. BMC Bioinformatics, 9, 559.
Onnela, J. P., Saramaki, J., Kertesz, J., & Kaski, K. (2005). Intensity and coherence of motifs in weighted complex networks. Physical Review E, 71(6), 065103.
Watts, D. J., & Strogatz, S. H. (1998). Collective dynamics of "small-world" networks. Nature, 393(6684), 440-442.
Zhang, B., & Horvath, S. (2005). A general framework for weighted gene co-expression network analysis. Statistical Applications in Genetics and Molecular Biology, 4(1).
centrality_auto
set.seed(1)
# generate a random (directed) network:
net_ig <- igraph::erdos.renyi.game(n=8, p.or.m=.4, type="gnp", directed=TRUE)
# convert it to an adjacency matrix:
net <- as.matrix(igraph:::get.adjacency(net_ig, type="both"))
# convert it to a signed and weighted network:
net <- net*matrix(rnorm(ncol(net)^2), ncol=ncol(net))
# make it undirected:
net[upper.tri(net)] <- t(net)[upper.tri(net)]
clustcoef_auto(net)
Run the code above in your browser using DataLab