> I've tried 3 different versions of code to calculate assortativity via
> degree correlation and two of them returned NA, while the third gave some
> reasonable numbers. My quistion is: can I trust it and why could 2 other
> receipts fail?

I use this:

# g is a graph
d = degree(g)
e = get.edgelist(g)
x = c(e[,1], e[,2])
y = c(e[,2], e[,1])
dx = d[x]
dy = d[y]
cor(dx, dy)

This corresponds to equation (7.82) page 230 of Mark Newman's book (Networks).

Best,

Massimo Franceschet
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to