Failure Analysis in Multi-Agent Networks: A Graph-Theoretic Approach