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.

362 CHAPTER 16. DYNAMICAL NETWORKS I: MODELINGThis new assumption is inspired by a pioneering adaptive network model <strong>of</strong> epidemic dynamicsproposed by my collabora<strong>to</strong>r Thilo Gross <strong>and</strong> his colleagues in 2006 [72]. Theyassumed that <strong>the</strong> edge from <strong>the</strong> susceptible <strong>to</strong> <strong>the</strong> infected nodes would be rewired <strong>to</strong>ano<strong>the</strong>r susceptible node in order <strong>to</strong> keep <strong>the</strong> number <strong>of</strong> edges constant. But here, weassume that such edges can just be removed for simplicity. For your convenience, Code16.6 for <strong>the</strong> SIS model is shown below again. Can you see where you can/should implementthis new edge removal assumption in this code?Code 16.13:p_i = 0.5 # infection probabilityp_r = 0.5 # recovery probabilitydef update():global ga = rd.choice(g.nodes())if g.node[a][’state’] == 0: # if susceptibleb = rd.choice(g.neighbors(a))if g.node[b][’state’] == 1: # if neighbor b is infectedg.node[a][’state’] = 1 if r<strong>and</strong>om() < p_i else 0else: # if infectedg.node[a][’state’] = 0 if r<strong>and</strong>om() < p_r else 1There are several different ways <strong>to</strong> implement adaptive edge removal in this code. Aneasy option would be just <strong>to</strong> insert ano<strong>the</strong>r if statement <strong>to</strong> decide whe<strong>the</strong>r <strong>to</strong> cut <strong>the</strong> edgeright before simulating <strong>the</strong> infection <strong>of</strong> <strong>the</strong> disease (third-<strong>to</strong>-last line). For example:Code 16.14:p_i = 0.5 # infection probabilityp_r = 0.5 # recovery probabilityp_s = 0.5 # severance probabilitydef update():global ga = rd.choice(g.nodes())if g.node[a][’state’] == 0: # if susceptibleb = rd.choice(g.neighbors(a))if g.node[b][’state’] == 1: # if neighbor b is infectedif r<strong>and</strong>om() < p_s:

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

Saved successfully!

Ooh no, something went wrong!