EoN.SIR_individual_based

EoN.SIR_individual_based(G, tau, gamma, rho=None, Y0=None, X0=None, nodelist=None, tmin=0, tmax=100, tcount=1001, transmission_weight=None, recovery_weight=None, return_full_data=False)[source]

Encodes System (3.30) of Kiss, Miller, & Simon. Please cite the book if using this algorithm.

See also:

Arguments:

G networkx Graph

tau positive float
transmission rate of disease
gamma number (default None)
global recovery rate
rho number between 0 and 1 (default None)
probability random node is infected. Cannot be defined along with X0 and Y0. At least one of rho and Y0 must be defined.
Y0 numpy array (default None)
the array of initial infection probabilities. If not defined, set to be rho uniformly.
X0 numpy array (default None)
the array of initial susceptibility probabilities. If not defined set to be 1-Y0. Cannot define X0 without Y0.
nodelist list (default None)
list of nodes in G in the same order as in X0 and Y0. Only relevant to returned data if return_full_data=True
tmin number (default 0)
minimum report time
tmax number (default 100)
maximum report time
tcount integer (default 1001)
number of reports
transmission_weight string (default None)
the label for a weight given to the edges. G.edge[i][j][transmission_weight] = g_{ij}
recovery_weight string (default None)

a label for a weight given to the nodes to scale their recovery rates

gamma_i = G.nodes[i][recovery_weight]*gamma
return_full_data (default False)
If True, returns times, S, I, R, Ss, Is, Rs if False, returns times, S, I, R
Returns:
if return_full_data is True:
returns times, Ss, Is, Rs where times is a numpy array of times, Ss is a 2D numpy array Ss[i,j] gives probability nodelist[i] is susceptible at time times[j]. Similarly for Is ans Rs
if return_full data is False:
returns times, S, I, R all are numpy arrays. gives times, and expected number susceptible, expected number infected, and expected number recovered
SAMPLE USE:
import networkx as nx
import EoN
import matplotlib.pyplot as plt

G = nx.configuration_model([3,10]*10000)
#G has 20000 nodes, half with degree 3 and half with degree 10

tau = 0.3
gamma = 1
N = G.order()
rho = 1./N

t, S, I, R = EoN.SIR_individual_based(G, tau, gamma, rho=rho, tmax = 20)
plt.plot(t,I)