EoN.basic_discrete_SIS(G, p, initial_infecteds=None, rho=None, tmin=0, tmax=100, return_full_data=False, sim_kwargs=None)[source]

Does a simulation of the simple case of all nodes transmitting with probability p independently to each susceptible neighbor and then recovering.

This is not directly described in Kiss, Miller, & Simon.

G networkx Graph
The network the disease will transmit through.
p number
transmission probability
initial_infecteds node or iterable of nodes (default None)
if a single node, then this node is initially infected if an iterable, then whole set is initially infected if None, then choose randomly based on rho. If rho is also None, a random single node is chosen. If both initial_infecteds and rho are assigned, then there is an error.
rho number
initial fraction infected. number is int(round(G.order()*rho))
return_full_data boolean (default False)
Tells whether a Simulation_Investigation object should be returned.
sim_kwargs keyword arguments
Any keyword arguments to be sent to the Simulation_Investigation object Only relevant if return_full_data=True
if return_full_data is False

t, S, I

All numpy arrays

if return_full_data is True

full_data Simulation_Investigation object

from this we can extract the status history of all nodes We can also plot the network at given times and even create animations using class methods.

import networkx as nx
import EoN
import matplotlib.pyplot as plt
G = nx.fast_gnp_random_graph(1000,0.002)
t, S, I = EoN.basic_discrete_SIS(G, 0.6, tmax = 20)