NPC algorithm is designed for learning Bayesian network formed as DAG in 2001, by Steck
This implementation is based on paper, details can be seen in this PhD thesis.
Start with "ControlCentor.m", there is a simple example with explanation of how to use the code here.
If there is any question. please let me know , i will answer you as soon as possible.
 Steck, H. (2001). Constrained-Based Structural Learning in Bayesian Networks Using Finite Data Sets, PhD Thesis.
I downloaded the code (npc) but could not run it as 'TrainingDatabase.mat' file is missing.
load('C:\Documents and Settings\newstar\My Documents\MATLAB\Myprogram\TrainDatabase.mat','Training_Database');
Indeed, the dependency test seems not so efficient, please try Fisher's test, which is also available in my website. Of course, the code itself is extensible by other statistic tests found in matlab community .
I dont know why but this code of yours is not working for my ALARM network dataset(1000 cases)....
Can you please elaborate on the chi-square test you are performing ih this code.
Add more information in description part
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.