Research Interests
Direct Links
Relevant Links

 

Tutorial 02 - Susceptible-Infected model

Let's start with a plain square lattice.

m = 100; % lattice dimentions
n = 100;
PInitialInfection = 3/10000; %the probability of infection at start. On average we'll start with 3 nodes
PSpontaneousInfection = 0; % the probability of spontaneous infection (not due to contagion) as the simulation runs.
PTransfer = 5/100; % the probability of infection transfer per link per unit time.
Graph = GraphGenerateSquareLattice(m,n); % create regular graph
Degrees = GraphCountNodesDegree(Graph); % compute degrees.
DP_SI = DynamicProcessInitializeSI(Graph,[],PInitialInfection,PSpontaneousInfection,PTransfer); % initialize SI for the lattice.
% Second parameter ([]) instructs the framework to extract node IDs from the Graph (i.e. no isolates).
% third parameter - probability of infection at start. On average we'll start with 3 nodes
% next - the probability of spontaneous infection (not due to contagion). as the simulation runs.
% last parameter - the probability of infection transfer per link per unit time.

while nnz(DP_SI.States)==0 % ensure that at least one node is infected at startup. Otherwise, infection will not start (spontan adoption,PSpontaneousInfection, is set to zero). DP_SI = DynamicProcessInitializeSI(Graph,[],PInitialInfection0,PSpontaneousInfection,PTransfer); end

sdsd