We develop a model for contagion risks and optimal security investment in a directed network of interconnected agents … degree distributions. The results allow us to derive a resilience condition of the network to the infection of a large group … of agents and quantify how contagion amplifies small shocks to the network. We show that when the degree distribution has …