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.

368 CHAPTER 16. DYNAMICAL NETWORKS I: MODELINGdef update():global g, nextgfor i in g.nodes_iter():ci = g.node[i][’state’]nextg.node[i][’state’] = ci + alpha * ( \sum((g.node[j][’state’] - ci) * g.edge[i][j][’weight’]for j in g.neighbors(i))) * Dtfor i, j in g.edges_iter():wij = g.edge[i][j][’weight’]nextg.edge[i][j][’weight’] = wij + beta * wij * (1 - wij) * ( \1 - gamma * abs(g.node[i][’state’] - g.node[j][’state’])) * Dtnextg.pos = nx.spring_layout(nextg, pos = g.pos, iterations = 5)g, nextg = nextg, gimport pycxsimula<strong>to</strong>rpycxsimula<strong>to</strong>r.GUI().start(func=[initialize, observe, update])In <strong>the</strong> initialize function, <strong>the</strong> edge weights are all initialized as 0.5, while node statesare set <strong>to</strong> 1 if <strong>the</strong> node belongs <strong>to</strong> Mr. Hi’s faction, or 0 o<strong>the</strong>rwise. There are alsosome modifications made <strong>to</strong> <strong>the</strong> observe function. Since <strong>the</strong> edges carry weights, weshould color each edge in a different gray level. Therefore additional options (edge_color,edge_cmap, edge_vmin, <strong>and</strong> edge_vmax) were used <strong>to</strong> draw <strong>the</strong> edges in different colors.The update function is pretty straightforward, I hope.Figure 16.14 shows <strong>the</strong> simulation result with α = 1, β = 3, γ = 3. With this setting,unfortunately, <strong>the</strong> edge weights became weaker <strong>and</strong> weaker between <strong>the</strong> two politicalfactions (while <strong>the</strong>y became stronger within each), <strong>and</strong> <strong>the</strong> Karate Club was eventuallysplit in<strong>to</strong> two, which was what actually happened. In <strong>the</strong> meantime, we can also seethat <strong>the</strong>re were some cultural/ideological diffusion taking place across <strong>the</strong> two factions,because <strong>the</strong>ir colors became a little more gray-ish than at <strong>the</strong> beginning. So, <strong>the</strong>re wasapparently a competition not just between <strong>the</strong> two factions, but also between <strong>the</strong> twodifferent dynamics: social assimilation <strong>and</strong> fragmentation. His<strong>to</strong>ry has shown that <strong>the</strong>fragmentation won in <strong>the</strong> actual Karate Club case, but we can explore <strong>the</strong> parameterspace <strong>of</strong> this model <strong>to</strong> see if <strong>the</strong>re was any alternative future possible for <strong>the</strong> Karate Club!Exercise 16.21 Examine, by simulations, <strong>the</strong> sensitivity <strong>of</strong> <strong>the</strong> Karate Club adaptivediffusion model on <strong>the</strong> initial node state assignments. Can a different node

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

Saved successfully!

Ooh no, something went wrong!