bnlearn is an R package for learning the graphical structure of Bayesian networks, estimate their parameters and perform some useful inference.