# Average behavior of degree distribution plots

I'll show what I'm doing in the moment and after that I'll explain what I'm trying to achieve. I use the following code to generate a large number of Barabási-Albert networks, and after that I plot the degree distribution of these networks.

net = Table[BarabasiAlbertGraphDistribution[100, 2], 5];
graph = RandomGraph /@ net;
degree = VertexDegree /@ graph;
k = Union /@ degree;
prob = Table[ (Table[
Probability[x >= i, x \[Distributed] deg[[j]]], {i, #}] &@
k[[j]]), {j, 1, Length[k]}];
cdf = Table[Transpose@{k[[i]], prat[[i]]}, {i, 1, Length[prat]}];
ListLogLogPlot[Table[cdf[[i]], {i, 1, 5}]]


From the ListLogLogPlot command I get the following plot:

Each color represent a dataset from the code above. Since the graphs generated through the Barabasi model are random, I generate a large number of them in order to find the average behavior of the degree distribution in order to compare it with the degree distribution of other network models. However, I can't find a function that works in this kind of datasets, specially because they have different lengths when you are working with large networks (4000-10000 nodes).

I tried using the Flatten and Union functions in order to have only one list with data points and used LinearFit and Interpolation functions without success. After Flatten and Union I have a plot like this:

b = Union[Flatten[cdf,1]]
ListLogLogPlot[b]


But even with a list with only one dataset the FitLinear and Interpolation functions won't work. Does anyone have a clue if I can find the average representation of these kind of datasets with Mathematica?

You are working with distributions. Instead of averaging, simply combine the data from multiple graphs before visualizing the distribution.

This combines the degrees from 1000 graphs:

degs = Join @@
VertexDegree /@
RandomGraph[BarabasiAlbertGraphDistribution[100, 2], 1000];


Visualizing the "CDF from the right" (survival function) only requires reverse sorting the data.

ListLogLogPlot[
Transpose@{ReverseSort[degs], Range@Length[degs]}
]


Or use Histogram

Histogram[degs, {"Log", Automatic}, {"Log", "PDF"}]


Histogram[degs, {"Log", Automatic}, {"Log", "SurvivalCount"}]


Combining the data first and then histogramming is in fact equivalent to histogramming first and then averaging histograms. Thus, don't try to average. Just combine the data.

• Thanks for the answer! I tried working on the full degree distribution of a huge number of networks but my problem was that I was treating it like an average, not a distribution like you showed. Thanks! Mar 26 '20 at 16:07