A Polya Urn Stochastic Model for the Analysis and Control of Epidemics on Networks