Degree and clustering
Many real-life social networks have the following properties simultaneously:
- Low average degree – most people have a limited set of friends
- High average clustering – most people are part of cliques
To study whether these conditions are satisfied by simple random graph models, the following little computational experiment was carried out. First, 51 Erdős-Rényi graphs were generated, one for each value of \(p\), where \(p\) is the rewiring probability and ranges from 0.0 to 0.5 in equally-spaced steps (of size 0.01). (The number of nodes was set to \(n=100\).) Then, the (1) mean degree and (2) mean local clustering coefficient was calculated for each of these graphs. The results are:
Next, the same experiment was performed but this time with Watts-Strogatz (small-world) networks instead, again sweeping over different values of the rewiring probability. The other parameters were set to \(n=100\) (network size) and \(k=16\) (initial degree). The results are:
This demonstrates that the two conditions, low average degree and high average clustering, can be achieved in Watts-Strogatz networks but not in Erdős-Rényi graphs.
Your task is to replicate the above analysis, producing the plots in the end.
You can make good use of array comprehensions, the mean
function from Statistics.jl, and this tip on how to put two vertical axes in the same plot.
For even more fun, think about the following questions:
- Why is the average degree a linearly increasing function of \(p\) in the case of Erdős-Rényi graphs?
- Why is it a constant function in the case of Watts-Strogatz graphs?
- Why is the average degree function “wiggly” in the case of Erdős-Rényi graphs but not so in the case of Watts-Strogatz graphs?
- Why is the average clustering wiggly in both cases?