Bayesian network sampler