Diffusion(graph, model='SIS', runs=10, steps=5000, b=0.00208, d=0.01, c=1, **kwargs)¶
Simulates the propagation of a virus using either the SIS or SIR model :cite`kermack1927contribution`.
graph – contact network
model – a string to set the model type (i.e., SIS or SIR)
runs – an integer number of times to run the simulation
steps – an integer number of steps to run a single simulation
b – float representing birth rate of virus (probability of transmitting disease to each neighbor)
d – float representing death rate of virus (probability of each infected node healing)
c – fraction of initially infected nodes
see parent class Simulation for additional options
Gets the effective string of the virus. This is a factor of the spectral radius (first eigenvalue) of graph, the virus birth rate ‘b’ and the virus death rate ‘d’
a float for virus effective strength
Resets the simulation between each run
The initially infected nodes are chosen uniformly at random. At each time step, every susceptible (i.e., non-infected) node has a probability ‘b’ of being infected by neighboring infected nodes. Every infected node has a probability ‘d’ of being cured and becoming susceptible again (or recovered for SIR model).
Keeps track of important simulation information at each step of the simulation
step – current simulation iteration