Lesson 6 of 15

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 kk follows a power law:

P(k)kγP(k) \sim k^{-\gamma}

where γ\gamma is the degree exponent (typically 2<γ<32 < \gamma < 3). Unlike a Poisson distribution, a power law has no characteristic scale — hence "scale-free."

PDF and CDF

The normalised power law PDF for kkmink \geq k_{\min} is:

P(k)=γ1kmin(kkmin)γP(k) = \frac{\gamma - 1}{k_{\min}} \left(\frac{k}{k_{\min}}\right)^{-\gamma}

The complementary CDF (probability that degree exceeds kk) is:

P(K>k)=(kkmin)(γ1)P(K > k) = \left(\frac{k}{k_{\min}}\right)^{-(\gamma-1)}

So the CDF is:

P(Kk)=1(kkmin)(γ1)P(K \leq k) = 1 - \left(\frac{k}{k_{\min}}\right)^{-(\gamma-1)}

Mean Degree

For γ>2\gamma > 2, the mean degree is finite:

k=kminγ1γ2\langle k \rangle = k_{\min} \cdot \frac{\gamma - 1}{\gamma - 2}

For γ2\gamma \leq 2, 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 γ=3\gamma = 3.

Fitting the Exponent

Given a set of observed degrees {ki}\{k_i\}, the maximum likelihood estimate of γ\gamma is:

γ^=1+N[i=1Nlnkikmin]1\hat{\gamma} = 1 + N \left[ \sum_{i=1}^{N} \ln\frac{k_i}{k_{\min}} \right]^{-1}

where kmin=min(ki)k_{\min} = \min(k_i) and NN is the number of observations.

Your Task

Implement four functions:

  • power_law_pdf(k, gamma, k_min=1) — evaluate the power law PDF at degree kk
  • power_law_cdf(k, gamma, k_min=1) — evaluate the CDF at degree kk
  • mean_degree_power_law(gamma, k_min=1) — return the mean degree (for γ>2\gamma > 2)
  • fit_power_law_exponent(degrees) — fit γ\gamma by maximum likelihood given a list of degrees
Python runtime loading...
Loading...
Click "Run" to execute your code.