Structural Heterogeneity And Performance In Stochastic Networks: From Distributed Inference To Epidemics And Beyond