15.08.2015 Views

Introduction to the Modeling and Analysis of Complex Systems

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

17.5. DEGREE DISTRIBUTION 391er = nx.erdos_renyi_graph(n, 0.01)ws = nx.watts_strogatz_graph(n, 10, 0.01)ba = nx.barabasi_albert_graph(n, 5)Pk = [float(x) / n for x in nx.degree_his<strong>to</strong>gram(er)]domain = range(len(Pk))loglog(domain, Pk, ’-’, label = ’Erdos-Renyi’)Pk = [float(x) / n for x in nx.degree_his<strong>to</strong>gram(ws)]domain = range(len(Pk))loglog(domain, Pk, ’--’, label = ’Watts-Strogatz’)Pk = [float(x) / n for x in nx.degree_his<strong>to</strong>gram(ba)]domain = range(len(Pk))loglog(domain, Pk, ’:’, label = ’Barabasi-Albert’)xlabel(’k’)ylabel(’P(k)’)legend()show()The result is shown in Fig. 17.9, which clearly illustrates differences between <strong>the</strong> threenetwork models used in this example. The Erdős-Rényi r<strong>and</strong>om network model has abell-curved degree distribution, which appears as a skewed mountain in <strong>the</strong> log-log scale(blue solid line). The Watts-Strogatz model is nearly regular, <strong>and</strong> thus it has a very sharppeak at <strong>the</strong> average degree (green dashed line; k = 10 in this case). The Barabási-Albertmodel has a power-law degree distribution, which looks like a straight line with a negativeslope in <strong>the</strong> log-log scale (red dotted line).Moreover, it is <strong>of</strong>ten visually more meaningful <strong>to</strong> plot not <strong>the</strong> degree distribution itselfbut its complementary cumulative distribution function (CCDF), defined as follows:∞∑F (k) = P (k ′ ) (17.29)k ′ =kThis is a probability for a node <strong>to</strong> have a degree k or higher. By definition, F (0) = 1 <strong>and</strong>F (k max + 1) = 0, <strong>and</strong> <strong>the</strong> function decreases mono<strong>to</strong>nically along k. We can revise Code17.15 <strong>to</strong> draw CCDFs:Code 17.16: ccdfs-loglog.py

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!