Scale-Free Networks
Scale-Free Networks
Many real-world networks — the internet, social networks, citation graphs — share a striking property: a few nodes have enormous numbers of connections while most nodes have very few. This is the hallmark of a scale-free network.
Power Law Distributions
In a scale-free network, the probability that a node has degree follows a power law:
where is the degree exponent (typically ). Unlike a Poisson distribution, a power law has no characteristic scale — hence "scale-free."
PDF and CDF
The normalised power law PDF for is:
The complementary CDF (probability that degree exceeds ) is:
So the CDF is:
Mean Degree
For , the mean degree is finite:
For , the mean diverges — an important result for network robustness.
The Barabási-Albert Model
The most famous mechanism generating scale-free networks is preferential attachment: when a new node joins, it connects to existing nodes with probability proportional to their current degree. Rich nodes get richer, producing a power law with .
Fitting the Exponent
Given a set of observed degrees , the maximum likelihood estimate of is:
where and is the number of observations.
Your Task
Implement four functions:
power_law_pdf(k, gamma, k_min=1)— evaluate the power law PDF at degreepower_law_cdf(k, gamma, k_min=1)— evaluate the CDF at degreemean_degree_power_law(gamma, k_min=1)— return the mean degree (for )fit_power_law_exponent(degrees)— fit by maximum likelihood given a list of degrees