@Test
public void testMoralize2() {
Graph<BayesVariable> graph = new BayesNetwork();
GraphNode x0 = addNode(graph);
GraphNode x1 = addNode(graph);
GraphNode x2 = addNode(graph);
GraphNode x3 = addNode(graph);
GraphNode x4 = addNode(graph);
GraphNode x5 = addNode(graph);
GraphNode x6 = addNode(graph);
connectParentToChildren(x1, x2, x3);
connectParentToChildren(x2, x4);
connectParentToChildren(x4, x5);
connectParentToChildren(x3, x5);
connectParentToChildren(x6, x5);
JunctionTreeBuilder jtBuilder = new JunctionTreeBuilder( graph );
jtBuilder.moralize();
assertLinkedNode(jtBuilder, new int[]{x1.getId(), 2, 3});
assertLinkedNode(jtBuilder, new int[]{x2.getId(), 1, 4});
assertLinkedNode(jtBuilder, new int[]{x3.getId(), 1, 4, 5, 6});
assertLinkedNode(jtBuilder, new int[]{x4.getId(), 2, 3, 5, 6});
assertLinkedNode(jtBuilder, new int[]{x5.getId(), 3, 4, 6});
assertLinkedNode(jtBuilder, new int[]{x6.getId(), 3, 4, 5});
}