A little bit late but hopefully this can help someone else.
The assortativityassortativity
function from igraphigraph
gives you the correlation between knn(k) and k, which is slightly negative in this case (-0.16) considering its values can range from 0 to 1.
The knnknn
function gives you the knn only, not k. So when you plot knnnet$knnknnnet$knn
, you are plotting knn against an index assigned to each vertex. Your graph probably has around 80 vertices, that's why the x axis goes until 80.
toTo get the actual assortativity plot, try this:
plot(degree(net), knnnet$knn, xlab = "k", ylab = "knn(k)")plot(degree(net), knnnet$knn, xlab = "k", ylab = "knn(k)")
. The plot should show more clearly the negative correlation.