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 wdnet object that represents the network. If NULL, the function will compute the coefficient using either edgelist and edgeweight, or adj.

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 NULL, all edges will be assigned weight 1.

adj

The adjacency matrix of a network.

directed

Logical. Indicates whether the edges in edgelist or adj are directed. It will be omitted if netwk is provided.

f1

A vector representing the first feature of existing nodes. The number of nodes should be equal to the length of both f1 and f2. Defined for directed networks. If NULL, out-strength will be used.

f2

A vector representing the second feature of existing nodes. Defined for directed networks. If NULL, in-strength will be used.

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

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
)


[Package wdnet version 1.2.3 Index]