[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Computing assortativity via degree correlation
From: |
Massimo Franceschet |
Subject: |
Re: [igraph] Computing assortativity via degree correlation |
Date: |
Thu, 29 Jan 2015 18:22:00 +0100 |
> 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