Contagious defaults in a credit portfolio: a Bayesian network approach