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.

388CHAPTER 17. DYNAMICAL NETWORKS II: ANALYSIS OF NETWORK TOPOLOGIESfrom pylab import *import networkx as nxpdata = []Ldata = []Cdata = []g0 = nx.watts_strogatz_graph(1000, 10, 0)L0 = nx.average_shortest_path_length(g0)C0 = nx.average_clustering(g0)p = 0.0001while p < 1.0:g = nx.watts_strogatz_graph(1000, 10, p)pdata.append(p)Ldata.append(nx.average_shortest_path_length(g) / L0)Cdata.append(nx.average_clustering(g) / C0)p *= 1.5semilogx(pdata, Ldata, label = ’L / L0’)semilogx(pdata, Cdata, label = ’C / C0’)xlabel(’p’)legend()show()The result is shown in Fig. 17.7, where <strong>the</strong> characteristic path length (L) <strong>and</strong> <strong>the</strong> averageclustering coefficient (C) are plotted as <strong>the</strong>ir fractions <strong>to</strong> <strong>the</strong> baseline values (L0, C0)obtained from a purely regular network g0. As you can see in <strong>the</strong> figure, <strong>the</strong> networkbecomes very small (low L) yet remains highly clustered (high C) at <strong>the</strong> intermediate value<strong>of</strong> p around 10 −2 . This is <strong>the</strong> parameter regime where <strong>the</strong> Watts-Strogatz small-worldnetworks arise.Exercise 17.10 Revise Code 17.12 so that you generate multiple Watts-Strogatznetworks for each p <strong>and</strong> calculate <strong>the</strong> averages <strong>of</strong> characteristic path lengths <strong>and</strong>average clustering coefficients. Then run <strong>the</strong> revised code <strong>to</strong> obtain a smoo<strong>the</strong>rcurve.

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

Saved successfully!

Ooh no, something went wrong!