A Greedy, Flexible Algorithm to Learn an Optimal Bayesian Network Structure