1
$\begingroup$

I'm trying to write a program that will measure the degree correlation of the network. The theory is here (page 8). I've written something like this up to now:

g = RandomGraph[BarabasiAlbertGraphDistribution[10000, 1]]; (*example network*)
t1 = VertexList[g];
t2 = Table[{VertexDegree[g, t1[[i]]], AdjacencyList[g, t1[[i]]]}, {i, 1, Length[t1]}];
t3 = Table[{t2[[i, 1]], N@Mean[Table[VertexDegree[g, t2[[i, 2]][[j]]], {j, 1, Length[t2[[i, 2]]]}]]}, {i, 1, Length[t1]}];
t4 = Split[Sort[t3], #1[[1]] == #2[[1]] &];
t5 = Table[{t4[[i, 1, 1]], Total[t4[[i]][[All, 2]]]}, {i, 1, Length[t4]}];

r1 = ListLogLogPlot[t5, PlotRange -> All]
dq = NonlinearModelFit[t5, b x^-a, {a, b}, x]
Show[r1, LogLogPlot[dq[x], {x, 1, 100}], Frame -> True]

I think the result is wrong because the parameter $a>1$ and should be in the range $[-1,1]$. I think the problem is related to the incorrect definition of t5 (formula 7.7, page 8). Does anyone have an idea how to correct it?

thanks, r

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.