The ABC-MCMC algorithm for inferring networks