created with NetLogo
view/download model file: ERDiffusionEB.nlogo
This model is a SI diffusion model on a random graph. SI means that individuals can be in two states - susceptible (meaning they can get the disease) or infected (meaning that they have the disease). Once they have the disease, they stay infected and can continue to infect others.
The original documentation is placed in quotes.
I've only really modified it to only optionally lay out the network, to have a probability 'p' of an infection spreading over an edge at each time step, and to plot the number of infected individuals over time.
Additionally, this is a diffusion model. After setting up the network with the desired number of nodes (num-nodes), it will infect one node at random. You can then step through the diffusion process either step by step (spread once) or until every node is infected (spread complete). The plot will show the number of nodes infected at each time point. The time monitor will give the current time, and in the case of the 'spread complete' option, how many steps it took until all the nodes are infected. Note that this is the SI model - nodes are either susceptible or infected and there is no recovery. The 'p' parameter gives the probability that a an infected node will infect a neighbor at each time step.
From here on down is Uri's original, much more organized documentation:
The model creates a network of the "numnodes" number of nodes with the given average degree, connecting pairs of nodes at random.
It then infects one individual at random.
The p slider determines the probability that an infected individual will infect a susceptible contact at every time step.
"The LAYOUT? switch controls whether or not the layout procedure is run. This procedure attempts to move the nodes around to make the structure of the network easier to see.
The PLOT? switch turns off the plots which speeds up the model.
The RESIZE-NODES button will make all of the nodes take on a size representative of their degree distribution. If you press it again the nodes will return to equal size.
If you want the model to run faster, you can turn off the LAYOUT? and PLOT? switches and/or freeze the view (using the on/off button in the control strip over the view). The LAYOUT? switch has the greatest effect on the speed of the model.
If you have LAYOUT? switched off, and then want the network to have a more appealing layout, press the REDO-LAYOUT button which will run the layout-step procedure until you press the button again. You can press REDO-LAYOUT at any time even if you had LAYOUT? switched on and it will try to make the network easier to see."
Use the p slider to specify the probability that an infected individual will infect a susceptible contact at every time step.
View the progress of the disease diffusion on the network on the plot showing the cumulative number of individuals infected.
You can also specify the number of nodes and the average degree/node.
Observe how varying the transmission probability p, and the average degree in the network affects the reach and speed of diffusion.
Try to see if you can create the SIS model - nodes recover and return to the 'susceptible state' after either a fixed time period, or with some probability at each time step. In this case you are looking for the conditions (e.g. given value of p or average degree) under which you will observe epidemics - outbreaks that affect a significant fraction of the network, vs. conditions under which the outbreak remains small and contained.
See other models in the Networks section of the Models Library, such as Giant Component.
See also Network Example, in the Code Examples section.