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.

16.2. SIMULATING DYNAMICS ON NETWORKS 333def update():global glistener = rd.choice(g.nodes())speaker = rd.choice(g.neighbors(listener))g.node[listener][’state’] = g.node[speaker][’state’]import pycxsimula<strong>to</strong>rpycxsimula<strong>to</strong>r.GUI().start(func=[initialize, observe, update])See how simple <strong>the</strong> update function is! This simulation takes a lot more steps for <strong>the</strong>system <strong>to</strong> reach a homogeneous state, because each step involves only two nodes. It isprobably a good idea <strong>to</strong> set <strong>the</strong> step size <strong>to</strong> 50 under <strong>the</strong> “Settings” tab <strong>to</strong> speed up <strong>the</strong>simulations.Exercise 16.2 Revise <strong>the</strong> code above so that you can measure how many stepsit will take until <strong>the</strong> system reaches a consensus (i.e., homogenized state). Thenrun multiple simulations (Monte Carlo simulations) <strong>to</strong> calculate <strong>the</strong> average timelength needed for consensus formation in <strong>the</strong> original voter model.Exercise 16.3 Revise <strong>the</strong> code fur<strong>the</strong>r <strong>to</strong> implement (1) <strong>the</strong> reversed <strong>and</strong> (2) <strong>the</strong>edge-based voter models. Then conduct Monte Carlo simulations <strong>to</strong> measure <strong>the</strong>average time length needed for consensus formation in each case. Compare <strong>the</strong>results among <strong>the</strong> three versions.Discrete state/time models (2): Epidemic model The second example <strong>of</strong> discretestate/time dynamical network models is <strong>the</strong> epidemic model on a network. Here we consider<strong>the</strong> Susceptible-Infected-Susceptible (SIS) model, which is even simpler than <strong>the</strong>SIR model we discussed in Exercise 7.3. In <strong>the</strong> SIS model, <strong>the</strong>re are only two states:Susceptible <strong>and</strong> Infected. A susceptible node can get infected from an infected neighbornode with infection probability p i (per infected neighbor), while an infected node can recoverback <strong>to</strong> a susceptible node (i.e., no immunity acquired) with recovery probability p r(Fig. 16.3). This setting still puts everything in binary states like in <strong>the</strong> earlier examples,so we can recycle <strong>the</strong>ir codes developed above.

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

Saved successfully!

Ooh no, something went wrong!