Chasing up and locking down the virus: Optimal pandemic interventions within a network