powered by NetLogo

Select a network type, then hit SETUP. Experiment with different networks and notice the various properties. Try to anticipate how a virus might spread.

Choose a lattice network–circle with four neighbors (this is just like a grid lattice network with each having four neighors, but here we show it arranged in a circle. The network is local, with only local neighbors, as you would see in a grid type neighborhood. The agents do not have connections to distant neighbors, but you can add these: Try rewiring a few links. This deletes an existing local link between two agents, two neighbors, and replaces with a link to a random agent. Hit rewire-one, several times, and agents now have several links to distant neighbors. At a certain proportion of links to distant neighbors, you will have a small-world network.

You can examine the properties of the network, such as the average path length between all pairs of agents. This calculates the shortest distance between all pairs of agents, then it averages all of these. Try a “connected” network (select "connected under network-type). Note that every agent is connected with every other agent so the average pathlength is 1.

If you choose a lattice network with a total only 5 nodes or less, for the lattice of 4-neighbors, the avg. path would be 1.

The program also computes the clustering-coefficient, which shows how connected the neighborhood of a node is. If fully connected, the clustering coefficient is 1, indicating that a nodes local friends are well connected to each other–“all my friends know each other.” A coefficient value near 0 means there are hardly any connections.

Then hit GO to see an infection spread through the network. Which network types would you expect to have the slowest spread of virus?

Now let’s modify a lattice network to give it properties of a small-world network. Select the quadratic or hexagonal-lattice network as network-type, then hit rewire-all, hit Setup and Go. The proportion of links rewired is set by your “rewiring probability” slider. If this is set at 30%, for example, then selecting rewire all reconnects 30% of local nodes. Now most these 30% are connected to non-local places in the network. This gives you a small world network. The clustering may be lower than in the lattice network but it is still pretty high. Small world networks also tend to have high clustering coefficients (my neighbors all know each other), considering that we have lengthened the path length.

Path lengths often are expensive, for example taking time for an infection or other condition (information) to traverse. What kind of network would maximize your connectivity while also minimizing path length?

A small world network has a relatively short average path length but still a relatively high clustering (You can see the relationship between clustering and path length on the plot if you repeatedly hit rewire-one. These are normalized values so that you can compare average path-length with the clustering coefficient).

How long does it take for the virus to spread through a small world network, relative to other types?

You can then try immunizing various proportions of the population.

Try a spatially clustered network with an average node degree that’s relatively high, say about 9. Try immunizing only 20% of the population, but choose the “hubs.” Compare that to immunizing, a random selection of 20% of the population.

The most interesting as well as realistic network, perhaps, is the preferential-attachment network. This is a more dynamically generated network, that grows over time with new links choosing the most connected prior node. It starts with one mode and then new nodes are added one at a time. Each new node connects to the existing with the most links, a rich-get-richer mechanism. This generates a scale-free network, similar to what is seen a great many real world networks.

Dr. Keane developed the program as a tutorial on network properties. Applications of this model are described in chapter 6 of Modeling Behavior in Complex Public Health Systems (Keane 2013). This program heavily relies on a variety of Netlogo commands, developed by Wilensky 2008.

The calculation of average-path-length and clustering coefficient, is borrowed directly from the “small worlds” model that comes with Netlogo. That model also supplies the programming for “highlighting” so that when the user clicks a node, the nodes neighbors turn blue and the links connecting them turns yellow. The calculation of shortest path-lengths uses the Floyd Warshall algorithm.

The basic programming for the preferential-attachment network comes from “preferential-attachment” in the Netlogo Models Library. See that model for more detail, including log-log plots of number of nodes by degree of nodes. That plot shows a straight line, demonstrating how this type of network is scale free.

In other publications, please use: Copyright 2008 Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/VirusonaNetwork for terms of use.