EoN.SIS_heterogeneous_meanfield¶
-
EoN.
SIS_heterogeneous_meanfield
(Sk0, Ik0, tau, gamma, tmin=0, tmax=100, tcount=1001, return_full_data=False)[source]¶ Encodes System (5.10) 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 pairs”
This is also called Degree-baded Mean Field or Mean Field Social Heterogeneity
a few notes on the inputs: Sk0 is an array (or a list).
It is not a dict.
Sk0[k] is the number of nodes that are susceptible and have degree k (even if some degrees missing).
A dict like this can be converted into an array by Sk0 = np.array([Sk0dict.get(k,0)
for k in range(max(Sk0dict.keys())+1)])Ik0 is similar to Sk0.
[dot{S}_k] = gamma [I_k] - au k [S_k] pi_I [dot{I}_k] = -(above) pi_I = sum_k k [I_k] / sum_k k [N_k]
Arguments: - Sk0 numpy array
- number susceptible for each k
- Ik0 numpy array
- number infected for each k
- 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)
- tells whether to just return times, S, I or all calculated data. if True, returns t, S, I, Sk, Ik
Returns: - if return_full_data is True:
- times, S, I, Sk (Sk is numpy 2D arrays)
- if return_full_data is False:
- times, S, I (all numpy arrays)
SAMPLE USE: import networkx as nx import EoN Sk0 = [995, 995, 995, 995, 995] Ik0 = [5, 5, 5, 5, 5] tau = 1 gamma = 2 t, S, I = EoN.SIS_heterogeneous_meanfield(Sk0, Ik0, tau, gamma, tmax = 10)