Skip to main content
. Author manuscript; available in PMC: 2016 Apr 21.
Published in final edited form as: J Theor Biol. 2015 Feb 16;371:154–165. doi: 10.1016/j.jtbi.2015.02.005

Algorithm 2 Simulating disease spread for a given network, A, and initial infection status of the population, s0.

t=0
while st(i) = 1 for some i ∈ {1, …, N} do
  t =t + 1
  % Infection of susceptible nodes %
  for all i ∈ {i|st−1(i) = 0} do
    Cinf(i)=k=1NAik1[st1(k)=1] {Count number of infected contacts}
   Set st(i) = 1 with probability p(i) = 1 − eCinf(i) β
  end for
  % Recovery of infected nodes %
  for all j ∈ {j|st−1(j)1} do
   Set st(j) = −1 with probability q = 1 − eδ
  end for
end while
ninf=i=1N1[st(i)=1]
return ninf {Final outbreak size}