assortcoef {wdnet} | R Documentation |
Compute the assortativity coefficient(s) for a network.
Description
Compute the assortativity coefficient(s) for a network.
Usage
assortcoef(netwk, edgelist, edgeweight, adj, directed, f1, f2)
Arguments
netwk |
A |
edgelist |
A two-column matrix representing edges. |
edgeweight |
A numeric vector of edge weights with the same length as
the number of rows in edgelist. If |
adj |
The adjacency matrix of a network. |
directed |
Logical. Indicates whether the edges in |
f1 |
A vector representing the first feature of existing nodes. The
number of nodes should be equal to the length of both |
f2 |
A vector representing the second feature of existing nodes. Defined
for directed networks. If |
Value
Assortativity coefficient for undirected networks, or a list of four assortativity coefficients for directed networks.
Note
When the adjacency matrix is binary (i.e., directed but unweighted
networks), assortcoef
returns the assortativity coefficient proposed
in Foster et al. (2010).
References
Foster, J.G., Foster, D.V., Grassberger, P. and Paczuski, M. (2010). Edge direction and the structure of networks. Proceedings of the National Academy of Sciences of the United States, 107(24), 10815–10820.
Yuan, Y. Zhang, P. and Yan, J. (2021). Assortativity coefficients for weighted and directed networks. Journal of Complex Networks, 9(2), cnab017.
Examples
set.seed(123)
control <- rpa_control_edgeweight(
sampler = function(n) rgamma(n, shape = 5, scale = 0.2)
)
netwk <- rpanet(nstep = 10^4, control = control)
ret <- assortcoef(netwk)
ret <- assortcoef(
edgelist = netwk$edgelist,
edgeweight = netwk$edge.attr$weight,
directed = TRUE
)