use of com.sri.ai.praise.core.inference.byinputrepresentation.interfacebased.core.exactbp.anytime.gabriel.aebptree.AEBPVariableTreeNode in project aic-praise by aic-sri-international.
the class BFS method next.
@Override
public AEBPFactorTreeNode next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
AEBPFactorTreeNode next = queue.remove();
for (Variable variableNeighbour : model.getEntireGraph().getNeighbors(next.getRoot())) {
AEBPVariableTreeNode variableTreeNode;
if (fromNodeToPartition.get(variableNeighbour) == null) {
variableTreeNode = new AEBPVariableTreeNode(variableNeighbour, next, isExhausted);
next.addChild(variableTreeNode);
fromNodeToPartition.put(variableNeighbour, variableTreeNode);
} else {
variableTreeNode = (AEBPVariableTreeNode) fromNodeToPartition.get(variableNeighbour);
}
for (Factor factorNeighbour : model.getEntireGraph().getNeighbors(variableNeighbour)) {
if (!visited.contains(factorNeighbour)) {
AEBPFactorTreeNode factorTreeNode = new AEBPFactorTreeNode(factorNeighbour, variableTreeNode, isExhausted);
// variableTreeNode.addChild(factorTreeNode);
visited.add(factorNeighbour);
queue.add(factorTreeNode);
}
}
}
return next;
}
Aggregations