EoN.SIR_heterogeneous_pairwise¶
-
EoN.
SIR_heterogeneous_pairwise
(Sk0, Ik0, Rk0, SkSl0, SkIl0, tau, gamma, tmin=0, tmax=100, tcount=1001, return_full_data=False, Ks=None)[source]¶ Encodes System (5.15) of Kiss, Miller, & Simon. Please cite the book if using this algorithm.
In the text this is often referred to as the “heterogeneous mean-field model closed at the level of triples”
[dot{S}_k] = -tau [S_k I] [dot{I}_k] = tau [S_k I] - gamma [I_k] [dot{R}_k] = gamma [I_k] (but using Rk=Nk-Sk-Ik for this equation) [dot{S_kI_l}] = -gamma[S_k I_l] + tau([S_k S_l I] - [I S_k I_l]
- [S_k I_l])
[dot{S_kS_l}] = -tau([S_k S_l I] + [I S_k S_l])
[A_l S_k I] = ((k-1)/k) [A_l S_k] [S_k I]/ [S_k] [I S_k A_l] = ((k-1)/k) [I S_k] [S_k A_l]/ [S_k]
Arguments: - Sk0 numpy array,
(if Ks is defined, the definition changes slightly, see below)
Sk0[k] is number of degree k susceptible at time 0.
- Ik0 numpy array
(if Ks is defined, the definition changes slightly, see below)
as in Sk0
- Rk0 numpy array
(if Ks is defined, the definition changes slightly, see below)
as in Sk0
- SkSl0 numpy 2D array
(if Ks is defined, the definition changes slightly, see below)
SkSl0[k][l] is [S_kS_l] at 0
- SkIl0 numpy 2D array
(if Ks is defined, the definition changes slightly, see below)
as in SkSl0
- tau positive float
- transmission rate
- gamma number
- recovery rate
- tmin number (default 0)
- minimum report time
- tmax number (default 100)
- maximum report time
- tcount integer (default 1001)
- number of reports
- return_full_data boolean (default False)
- If True, return times, Sk, Ik, Rk, SkIl, SkSl If False, return times, S, I, R
- Ks numpy array. (default
None
) - (helps prevent memory errors) if some degrees are not observed, then the corresponding entries of these arrays are zero. This can lead to memory errors in the case of a network with many missing degrees. So Ks is an (assumed) ordered vector stating which Ks are actually observed. Then the Sk0[i] is the number of nodes that are susceptible and have degree Ks[i]. Similarly for Ik0 and SkIl0 etc.
Returns: - if return_full_data is True
- returns times, S, I, R, Sk, Ik, Rk, SkIl, SkSl
- if return_full_data is False
- return times, S, I, R
SAMPLE USE: import networkx as nx import EoN