public boolean[][] moralize(BayesNet bayesNet){
  int nNodes=bayesNet.getNrOfNodes();
  boolean[][] bAdjacencyMatrix=new boolean[nNodes][nNodes];
  for (int iNode=0; iNode < nNodes; iNode++) {
    ParentSet parents=bayesNet.getParentSets()[iNode];
    moralizeNode(parents,iNode,bAdjacencyMatrix);
  }
  return bAdjacencyMatrix;
}

public boolean [ ] [ ] moralize ( BayesNet bayesNet ) { int nNodes = bayesNet . getNrOfNodes ( ) ; boolean [ ] [ ] bAdjacencyMatrix = new boolean [ nNodes ] [ nNodes ] ; for ( int iNode = 0 ; iNode < nNodes ; iNode ++ ) { ParentSet parents = bayesNet . getParentSets ( ) [ iNode ] ; moralizeNode ( parents , iNode , bAdjacencyMatrix ) ; } return bAdjacencyMatrix ; }
moralize dag and calculate adjacency matrix representation for a bayes network , effecively converting the directed acyclic graph to an undirected graph .
