Extending SIR epidemic model with a quarantined/immunised state

Dear All,

I recently started looking into graph-tool because I was looking for a fast graph library to implement an SIR epidemic model. To my delight, I discovered that graph-tool has extremely fast epidemic models implemented already.

My issue is that I wish to study the effects of immunising/quarantining individuals on the overall spread of the disease and am looking for a way to extend graph-tool’s model to achieve this. In particular, I wish to be able to quarantine people for a fixed amount of time (or indefinitely in the case of immunisation).

Initially, I thought I would be able maintain who is quarantined (and for how long) with a vertex property map and filter the quarantined individuals out from the network using a vertex filter. However, I noticed that the iterate_sync() function, which iterates the model by one time step, seems to ignore vertex filters. In particular, if I filter out all infected individuals, it will still infect new people.

My second idea was to directly edit the vertex property maps that store the state of each individual in the graph (susceptible, infected and recovered), and introduce an additional ‘immunised’ state (with value 4, say). However, I have noticed that changing the values of instance.s and instance.s_copy does not seem to have any effect on iterate_sync(). In particular, if I mark everyone as susceptible and thus nobody as infected, it still infects new people in the next time step when I call iterate_sync(). So I am assuming that the state is also stored elsewhere?

Any pointers that might help me extend graph-tool’s SIR model to incorporate quarantining/immunising would be greatly appreciated. I have tried implementing my own model from scratch, but it is significantly slower.

Best regards,
Edwin

Initially, I thought I would be able maintain who is quarantined (and for how long) with a vertex property map and filter the quarantined individuals out from the network using a vertex filter. However, I noticed that the iterate_sync() function, which iterates the model by one time step, seems to ignore vertex filters. In particular, if I filter out all infected individuals, it will still infect new people.

Using the epidemic models on filtered graphs should work. Maybe you
should try explaining in more detail how you are doing it so we can see
what the problem may be.

My second idea was to directly edit the vertex property maps that store the state of each individual in the graph (susceptible, infected and recovered), and introduce an additional ‘immunised’ state (with value 4, say). However, I have noticed that changing the values of instance.s and instance.s_copy does not seem to have any effect on iterate_sync(). In particular, if I mark everyone as susceptible and thus nobody as infected, it still infects new people in the next time step when I call iterate_sync(). So I am assuming that the state is also stored elsewhere?

Indeed this approach will not work so well, as the logic of the dynamics
only differentiates between three states, not four.

Any pointers that might help me extend graph-tool’s SIR model to incorporate quarantining/immunising would be greatly appreciated. I have tried implementing my own model from scratch, but it is significantly slower.

As mentioned above, filtered graphs should work. In addition, the SIR
model allows for different transmission probabilities on each edge, by
passing an edge property map as the 'beta' parameter, which you can set
to zero for the edges incident on quarantined nodes. If these change
over time, don't forget to pass the 'constant_beta=False' option as well.

Best,
Tiago