K2 algorithm is the most famous score-based algorithm in Bayesian netowrk in the last two decades. Specifically, it recovers the underlying distribution in the form of DAG efficiently. For details, please refer to Cooper's published paper
Please start from "ControlCentor.m", here is a simple example for understanding how to use our code.
If there is any question, please let me know, i will help you as soon as possible.
I use rewritten the K2 by mex programming, if you know how to compile it, please try K2.c because this code is able to handle the variables as large as 1000 variables, much efficient. It's tested under linux both 32-bit and 64-bit.
 G. Cooper and E. Herskovitz, A Bayesian method for the induction of probabilistic networks from data, Machine Learning
9 (1992), 330–347.
If you use this code, please cite our paper:
Bielza, C., Li, G. & Larrañaga, P. (2011). Multi-Dimensional Classification with Bayesian Networks. International Journal of Approximate Reasoning, 52, 705-727.