Am 10.04.20 um 09:54 schrieb Edwin Lock:
Thanks for getting back to me so quickly!
I have a ‘quarantined’ vertex property map that maintains who is quarantined and have set a vertex filter on the graph to filter out quarantined people. Quarantined people are not supposed to be able to infect others.
Here is a minimum working example where I quarantine all infected people from the graph but new people are infected in the next time step.
# SETUP from graph_tool.generation import price_network from graph_tool.dynamics import SIRSState g = price_network(20) model = SIRSState(g, r=0) # make sure there are no spontaneous infections state = model.get_state() # Keep track of who is quarantined quarantined = g.new_vertex_property('bool', False) # Filter out quarantined nodes from graph g.set_vertex_filter(quarantined, inverted=True)
I imagined you were maybe doing it like this... Indeed, the SIRSState keeps track of the original unfiltered graph. What you need to do is to set the filter before you create the SIRSState, and it should work as you are expecting.
Another question: I want to stop quarantined people from infecting others, but I do want them to recover with the same probability as non-quarantined people. In this case it makes sense to use an edge filter to remove all edges adjacent to a quarantined person instead of filtering the person’s vertex itself, right?
Yes, this would be the correct approach. It would also be equivalent to modifying the beta parameter as I described previously. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>