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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

392CHAPTER 17. DYNAMICAL NETWORKS II: ANALYSIS OF NETWORK TOPOLOGIES10 0Erdos-RenyiWatts-StrogatzBarabasi-Albert10 -1P(k)10 -210 -310 0 10 1 10 2 10 3Figure 17.9: Visual output <strong>of</strong> Code 17.15.kfrom pylab import *import networkx as nxn = 1000er = 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))ccdf = [sum(Pk[k:]) for k in domain]loglog(domain, ccdf, ’-’, label = ’Erdos-Renyi’)Pk = [float(x) / n for x in nx.degree_his<strong>to</strong>gram(ws)]domain = range(len(Pk))ccdf = [sum(Pk[k:]) for k in domain]loglog(domain, ccdf, ’--’, label = ’Watts-Strogatz’)

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

Saved successfully!

Ooh no, something went wrong!