public boolean iteration() {
if( index==-1 ) {
orderNodes();
} else {
BayesianEvent event = this.nodeOrdering.get(index);
double oldP = this.calculateG(network, event, event.getParents());
while( event.getParents().size()<this.train.getMaximumParents() ) {
BayesianEvent z = findZ(event,index,oldP);
if(z!=null) {
this.network.createDependency(z, event);
oldP = this.lastCalculatedP;
} else {
break;