assortativity (graph, types1, types2 = NULL, directed = TRUE)
assortativity.nominal (graph, types, directed = TRUE)
assortativity.degree (graph, directed = TRUE)
as.integer
.NULL
here if you want to use the same values
for outgoing and incoming edges. This argument is ignored
(withTRUE
here to do the natural thing, i.e. use
directed version of the measure for directed graphs and thassortativity.nominal
calculates this measure. It is
defines as$$r=\frac{\sum_i e_{ii}-\sum_i a_i b_i}{1-\sum_i a_i b_i}$$
where $e_{ij}$ is the fraction of edges connecting vertices
of type $i$ and $j$,
$a_i=\sum_j e_{ij}$ and
$b_j=\sum_i e_{ij}$.
The second assortativity variant is based on values assigned to the
vertices. assortativity
calculates this measure. It is defined
as
$$r=\frac1{\sigma_q^2}\sum_{jk} jk(e_{jk}-q_j q_k)$$
for undirected graphs ($q_i=\sum_j e_{ij}$) and as
$$r=\frac1{\sigma_o\sigma_i}\sum_{jk}jk(e_{jk}-q_j^o q_k^i)$$
for directed ones. Here $q_i^o=\sum_j e_{ij}$, $q_i^i=\sum_j e_{ji}$, moreover, $\sigma_q$, $sigma_o$ and $sigma_i$ are the standard deviations of $q$, $q^o$ and $q^i$, respectively.
The reason of the difference is that in directed networks the relationship is not symmetric, so it is possible to assign different values to the outgoing and the incoming end of the edges.
assortativity.degree
uses vertex degree (minus one) as vertex
values and calls assortativity
.
M. E. J. Newman: Assortative mixing in networks,
Phys. Rev. Lett. 89, 208701 (2002)
# random network, close to zero
assortativity.degree(erdos.renyi.game(10000,3/10000))
# BA model, tends to be dissortative
assortativity.degree(ba.game(10000, m=4))
Run the code above in your browser using DataCamp Workspace