Controlling Epidemics Through Optimal Allocation of Test Kits and Vaccine Doses Across Networks