Given a categorical vertex attribute describing mutually exclusive groups, the assortativity coefficient represents the tendency for nodes to form ties with similar alters.

assort_discrete(g, node_attr_name, ...)

assort_scalar(g, val1, val2 = NULL)

assort_degree(g)

Arguments

g

<igraph>, <network>

node_attr_name

<chr> The name of a node/vertex attribute in g.

...

Arguments passed to or from other methods.

val1

Continuous vector.

val2

Continuous vector.

Details

$$ r = \frac{ \sum_i{e_{ii} - \sum_i{a_ib_i}} } {1 - \sum_i{a_ib_i} } $$

  • \(e\): mixing matrix

  • \(e_{ii}\): diagonal of mixing matrix

  • \(a_i\): row sums of mixing matrix

  • \(b_i\): column sums of mixing matrix

References

M. E. J. Newman, Mixing patterns in networks, Physical Review E, 67 026126, 2003. https://arxiv.org/pdf/cond-mat/0209450.pdf.

Examples

data("faux.desert.high", package = "ergm") assort_discrete(faux.desert.high, node_attr_name = "race")
#> [1] 0.01577169
data("sampson", package = "ergm") assort_discrete(samplike, "group")
#> [1] 0.5445606