On Line

Localized Network SIR Model

Susceptible: Infected: Recovered:

Network SIR Model

This model is derived from the "Virus on a Network" model included in the NetLogo model library. See Stonedahl, F. and Wilensky, U. (2008). NetLogo Virus on a Network model. http://ccl.northwestern.edu/netlogo/models/VirusonaNetwork. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. The text that follows is based on the information distributed with that model.

The model demonstrates the spread of a virus through a network. Although the model is somewhat abstract, one interpretation is that each node represents a computer, and we are modeling the progress of a computer virus (or worm) through this network. Each node may be in one of three states: susceptible, infected, or resistant. In the academic literature such a model is sometimes referred to as an SIR model for epidemics.

In this version a network of 400 nodes is divided into 4 "localities" of 100 nodes each. Within each locality the nodes form a grid with as many as 8 immediate neighbors. Local connections are only possible within immediate neighborhoods. In addition, a small number of "non-local" connections join nodes in different localities.

We choose to use the d3 force layout (Bostok) to visualize the nodes rather than a static grid layout. As a result we achieve a precise separation of the localities as well as a clear depiction of all non-local connections.


Initially, only one locality (the upper left) contains infected nodes. Each time step (tick), each infected node (colored red) attempts to infect all of its neighbors. This spread is visualized with magenta-colored links. Susceptible neighbors (colored green) will be infected with a probability given by the VIRUS-SPREAD-PROB slider. This might correspond to the probability that someone on the susceptible system actually executes the infected email attachment. Resistant nodes (colored blue) cannot be infected. This might correspond to up-to-date antivirus software and security patches that make a computer immune to this particular virus. Infected nodes are not immediately aware that they are infected. Only every so often (determined by the VIRUS-CHECK-FREQ slider) do the nodes check whether they are infected by a virus. This might correspond to a regularly scheduled virus-scan procedure, or simply a human noticing something fishy about how the computer is behaving. When the virus has been detected, there is a probability that the virus will be removed (determined by the RECOVERY-PROB slider). If a node does recover, there is some probability that it will become resistant to this virus in the future (given by the GAIN-RESISTANCE slider).


Use the VN-OR-MOORE switch to create a network with potential connectivity to either the Von Neumann (red) or Moore (green) local neighborhood of each node. The Von Neumann neighborhood is limited to the North, South East and West directions, with the Moore neighborhood adding Northeast, Southeast, Southwest and Northwest neighbors.

Use the LOCAL-CONNECTION-PROBABILITY slider to determine the average number of connections within a local neighborhood. Note that for a given connection probability, more connections will be made when using the Moore neighborhood. The NON-LOCAL-CONNECTION-PROBABILITY slider determines the number of connections between nodes in different localities. Statistically, each .00001 increase increases the average number of such connections, μ, by 12 (i.e., for .00001, μ = 12, for .00002, μ = 24, etc.)

Click RESET to initialize the simulation. Double-clicking RESET also reconfigures the network.

The VIRUS-SPREAD-PROB, VIRUS-CHECK-FREQ, RECOVERY-PROB, and GAIN-RESISTANCE sliders (discussed in "How it Works" above) can be adjusted before pressing start, or while the model is running.

Last modified: Fri Jul 8 13:54:47 EDT 2016