I am trying to implement the SIR epidemic model. Basically, the way I understand the model is that at each time step, it tells us how many nodes get infected and how many nodes are recovered. I am now trying to convert this into an discrete-event simulation and am confused at a point.
The model is generally solved using Euler's method. Now, when I am converting it into a discrete event simulation, I am doing something like this (the numbers are used for clarity):
Initialize 100 members
At every time step t,
//Determine how many get infected
for i = 1 to 100
let i pass a message to its neighbors
When the neighbor receives the message from an infected member, it generates a random number and if it is less than beta*(infected/total), where beta is the infection rate, then the member gets infected
Update the count for infected, recovered, susceptible
//Determine how many are recovered
for i = 1 to 100
Generate a random number from a uniform distribution and check if it is less than gamma*infected. If it is, then this member is recovered.
Update the count for infected, recovered, susceptible
I was essentially wondering if the above approach is right. Any suggestions?