private void checkForNoCycle (VarSet parents, Variable child, CPT cpt) {
ConnectivityInspector inspector = new ConnectivityInspector (graph);
for (Iterator it = parents.iterator (); it.hasNext ();) {
Variable rent = (Variable) it.next ();
if (inspector.pathExists (child, rent)) {
throw new IllegalArgumentException ("Error adding CPT: Would create directed cycle"+
"From: "+rent+" To:"+child+"\nCPT: "+cpt);
}
}
}