Diffusion¶

class
graph_tiger.diffusion.
Diffusion
(graph, model='SIS', runs=10, steps=5000, b=0.00208, d=0.01, c=1, **kwargs)¶ Bases:
graph_tiger.simulations.Simulation
Simulates the propagation of a virus using either the SIS or SIR model :cite`kermack1927contribution`.
 Parameters
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
**kwargs –
see parent class Simulation for additional options

get_effective_strength
()¶ 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’
 Returns
a float for virus effective strength

reset_simulation
()¶ Resets the simulation between each run

run_single_sim
()¶ The initially infected nodes are chosen uniformly at random. At each time step, every susceptible (i.e., noninfected) 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).

track_simulation
(step)¶ Keeps track of important simulation information at each step of the simulation
 Parameters
step – current simulation iteration

graph_tiger.diffusion.
main
()¶