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.

372CHAPTER 17. DYNAMICAL NETWORKS II: ANALYSIS OF NETWORK TOPOLOGIESThe density <strong>of</strong> a network is <strong>the</strong> fraction between 0 <strong>and</strong> 1 that tells us what portion <strong>of</strong>all possible edges are actually realized in <strong>the</strong> network. For a network G made <strong>of</strong> nnodes <strong>and</strong> m edges, <strong>the</strong> density ρ(G) is given byρ(G) =mn(n−1)2=2mn(n − 1)(17.1)for an undirected network, orρ(G) =mn(n − 1)(17.2)for a directed network.NetworkX has a built-in function <strong>to</strong> calculate network density:Code 17.2:>>> g = nx.karate_club_graph()>>> nx.density(g)0.13903743315508021Note that <strong>the</strong> size <strong>and</strong> density <strong>of</strong> a network don’t specify much about <strong>the</strong> network’s actual<strong>to</strong>pology (i.e., shape). There are many networks with different <strong>to</strong>pologies that have exactly<strong>the</strong> same size <strong>and</strong> density.But <strong>the</strong>re are some things <strong>the</strong> size <strong>and</strong> density can still predict about networks. Onesuch example is network percolation, i.e., whe<strong>the</strong>r or not <strong>the</strong> nodes are sufficiently connected<strong>to</strong> each o<strong>the</strong>r so that <strong>the</strong>y form a giant component that is visible at macroscopicscales. I can show you an example. In <strong>the</strong> code below, we generate Erdős-Rényi r<strong>and</strong>omgraphs made <strong>of</strong> 100 nodes with different connection probabilities:Code 17.3: net-percolation.pyfrom pylab import *import networkx as nxfor i, p in [(1, 0.0001), (2, 0.001), (3, 0.01), (4, 0.1)]:subplot(1, 4, i)title(’p = ’ + str(p))g = nx.erdos_renyi_graph(100, p)nx.draw(g, node_size = 10)

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

Saved successfully!

Ooh no, something went wrong!