clustcoef {wdnet} | R Documentation |
Directed clustering coefficient
Description
Compute the clustering coefficient of a weighted and directed network.
Usage
clustcoef(
netwk,
edgelist,
edgeweight,
adj,
directed = TRUE,
method = c("Clemente", "Fagiolo"),
isolates = 0
)
Arguments
netwk |
A |
edgelist |
A two-column matrix, each row represents a directed edge of the network. |
edgeweight |
A vector representing the weight of edges. |
adj |
An adjacency matrix of a weighted and directed network. |
directed |
Logical. Indicates whether the edges in |
method |
Which method used to compute clustering coefficients: Clemente and Grassi (2018) or Fagiolo (2007). |
isolates |
Binary, defines how to treat vertices with degree zero and
one. If 0, then their clustering coefficient is returned as 0 and are
included in the averaging. Otherwise, their clustering coefficient is |
Value
Lists of local clustering coefficients (in terms of a vector), global
clustering coefficient (in terms of a scalar) and number of weighted
directed triangles (in terms of a vector) based on total
, in
,
out
, middleman (middle
), or cycle
triplets.
Note
Self-loops (if exist) are removed prior to the computation of
clustering coefficient. When the adjacency matrix is symmetric (i.e.,
undirected but possibly unweighted networks), clustcoef
returns
local and global clustering coefficients proposed by Barrat et al. (2010).
References
Barrat, A., Barthelemy, M., Pastor-Satorras, R. and Vespignani, A. (2004). The architecture of complex weighted networks. Proceedings of National Academy of Sciences of the United States of America, 101(11), 3747–3752.
Clemente, G.P. and Grassi, R. (2018). Directed clustering in weighted networks: A new perspective. Chaos, Solitons & Fractals, 107, 26–38.
Fagiolo, G. (2007). Clustering in complex directed networks. Physical Review E, 76, 026107.
Examples
## Generate a network according to the Erd\"{o}s-Renyi model of order 20
## and parameter p = 0.3
edge_ER <- rbinom(400, 1, 0.3)
weight_ER <- sapply(edge_ER, function(x) x * sample(3, 1))
adj_ER <- matrix(weight_ER, 20, 20)
mycc <- clustcoef(adj = adj_ER, method = "Clemente")
system.time(mycc)