Consider an undirected graph G=(V,E) representing a population. Nodes of the graph are individuals. The presence of an edge between two individuals indicates that they are in close contact with each other (e.g, sharing a home or a workplace).
Generate a graph on 100 nodes as follows: for each pair of nodes, toss a fair coin and put an edge between them if and only if you get a heads. This gives you a population graph. Every individual is in one of the following states: susceptible, infected, or recovered (aka removed). The possible transition for each individual is susceptible to infected to recovered.
β Data Structures:
β Sets S, I and R.
β Binary heap with nodes having
β Node id
β TimeStamp
β Event type: Infection/Recovery β Initially all nodes are in S.
β Choose a starting node arbitrarily and call it u.
β Insert this infection event in the min-Queue Q, with timestamp 0. β While(;;)
β e<-DeleteMin(Q)
β If e is a Recovery event,
β R<- R U {e.nodeID}
β I<- I{e.nodeID}
β If e is an infection event,
β I<- I U {e.nodeID}
β S<- S{e.nodeID}
β Forall susceptible neighbors u of e.nodeId
β Generate an infectionTime as follows
β Toss a fair coin five times
β Let j be the first time a head comes (if a head doesnβt appear at all, u doesnβt get infected because of e.nodeid), continue to next neighbor β Insert into Q:
β Node id:u
β TimeStamp: e.timeStamp+j
β Event type: Infection
β (If u did get infected) generate recovery event:
β Generate a random number k uniformly between
e.timeStamp+j and e.timeStamp+j+5 β Insert into Q:
β Node id:u
β TimeStamp: k
β Event type: Recovery
1. Plot the number of susceptible, infected and recovered individuals, against i.
2. Compare the instant at which a node gets infected with itβs shortest distance from the start node s.
[SOLVED] CS2233 Assignment 4- Discrete Event Simulation for Pandemics
39.99 $
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
Securely Powered by:
- Assignment-4-tatdpl.zip






