@Test public void testJunctionWithPruning2() { 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); GraphNode x7 = addNode(graph); List<OpenBitSet> list = new ArrayList<OpenBitSet>(); OpenBitSet OpenBitSet1 = bitSet("00001111"); OpenBitSet OpenBitSet2 = bitSet("00111100"); OpenBitSet OpenBitSet3 = bitSet("11100000"); OpenBitSet OpenBitSet4 = bitSet("00100001"); OpenBitSet intersect1And2 = ((OpenBitSet)OpenBitSet2.clone()); intersect1And2.and(OpenBitSet1); OpenBitSet intersect2And3 = ((OpenBitSet)OpenBitSet2.clone()); intersect2And3.and(OpenBitSet3); OpenBitSet intersect1And4 = ((OpenBitSet)OpenBitSet1.clone()); intersect1And4.and(OpenBitSet4); list.add(OpenBitSet1); list.add(OpenBitSet2); list.add(OpenBitSet3); list.add(OpenBitSet4); JunctionTreeBuilder jtBuilder = new JunctionTreeBuilder( graph ); JunctionTreeClique jtNode = jtBuilder.junctionTree(list, false).getRoot(); JunctionTreeClique root = jtNode; assertEquals( OpenBitSet1, root.getBitSet() ); assertEquals( 2, root.getChildren().size() ); JunctionTreeSeparator sep = root.getChildren().get(0); assertEquals( OpenBitSet1, sep.getParent().getBitSet() ); assertEquals( OpenBitSet2, sep.getChild().getBitSet() ); assertEquals(1, sep.getChild().getChildren().size()); jtNode = sep.getChild(); assertEquals( OpenBitSet2, jtNode.getBitSet() ); assertEquals( 1, jtNode.getChildren().size() ); sep = jtNode.getChildren().get(0); assertEquals( OpenBitSet2, sep.getParent().getBitSet() ); assertEquals( OpenBitSet3, sep.getChild().getBitSet() ); assertEquals( intersect2And3, sep.getBitSet() ); assertEquals( 0, sep.getChild().getChildren().size()); sep = root.getChildren().get(1); assertEquals( OpenBitSet1, sep.getParent().getBitSet() ); assertEquals( OpenBitSet4, sep.getChild().getBitSet() ); assertEquals( intersect1And4, sep.getBitSet() ); assertEquals( 0, sep.getChild().getChildren().size() ); }
public JunctionTree junctionTree(List<OpenBitSet> cliques, boolean init) { return junctionTree(null, null, null, cliques, init); }
JunctionTreeBuilder { public JunctionTree junctionTree(List<OpenBitSet> cliques, boolean init) { return junctionTree(null, null, null, cliques, init); } }
JunctionTreeBuilder { public JunctionTree junctionTree(List<OpenBitSet> cliques, boolean init) { return junctionTree(null, null, null, cliques, init); } JunctionTreeBuilder(Graph<BayesVariable> graph); }
JunctionTreeBuilder { public JunctionTree junctionTree(List<OpenBitSet> cliques, boolean init) { return junctionTree(null, null, null, cliques, init); } JunctionTreeBuilder(Graph<BayesVariable> graph); Graph<BayesVariable> getGraph(); JunctionTree build(); JunctionTree build(boolean init); JunctionTree build(Resource resource, String namespace, String name); JunctionTree build(Resource resource, String namespace, String name, boolean init); void moralize(); void moralize(GraphNode<BayesVariable> v, GraphNode v1); static void connect(boolean[][] adjMatrix, int v1, int v2); static void disconnect(boolean[][] adjMatrix, int v1, int v2); List<OpenBitSet> triangulate(); void eliminateVertex(PriorityQueue<EliminationCandidate> p, Map<Integer, EliminationCandidate> elmVertMap, boolean[][] clonedAdjMatrix, boolean[] adjList, Set<Integer> verticesToUpdate, EliminationCandidate v); void createClique(int v, boolean[][] clonedAdjMatrix, Set<Integer> verticesToUpdate, boolean[] adjList); static void updateCliques(List<OpenBitSet> cliques, OpenBitSet newClique); boolean[][] getAdjacencyMatrix(); static boolean[][] cloneAdjacencyMarix(boolean[][] src); JunctionTree junctionTree(List<OpenBitSet> cliques, boolean init); JunctionTree junctionTree(Resource resource, String namespace, String name, List<OpenBitSet> cliques, boolean init); void mergeGraphs(SeparatorSet[][][] graphs, SeparatorSet separatorSet); int createJunctionTreeGraph(SeparatorSet[][] sepGraph, JunctionTreeClique parent, JunctionTreeClique[] jtNodes, JunctionTreeSeparator[] jtSeps, int i); void mapNodeToCliqueFamily(OpenBitSet[] varNodeToCliques, JunctionTreeClique[] jtNodes); void mapVarNodeToCliques(OpenBitSet[] nodeToCliques, int id, OpenBitSet clique); static List<Integer> getAdjacentVertices(boolean[][] adjacencyMatrix, int i); }
JunctionTreeBuilder { public JunctionTree junctionTree(List<OpenBitSet> cliques, boolean init) { return junctionTree(null, null, null, cliques, init); } JunctionTreeBuilder(Graph<BayesVariable> graph); Graph<BayesVariable> getGraph(); JunctionTree build(); JunctionTree build(boolean init); JunctionTree build(Resource resource, String namespace, String name); JunctionTree build(Resource resource, String namespace, String name, boolean init); void moralize(); void moralize(GraphNode<BayesVariable> v, GraphNode v1); static void connect(boolean[][] adjMatrix, int v1, int v2); static void disconnect(boolean[][] adjMatrix, int v1, int v2); List<OpenBitSet> triangulate(); void eliminateVertex(PriorityQueue<EliminationCandidate> p, Map<Integer, EliminationCandidate> elmVertMap, boolean[][] clonedAdjMatrix, boolean[] adjList, Set<Integer> verticesToUpdate, EliminationCandidate v); void createClique(int v, boolean[][] clonedAdjMatrix, Set<Integer> verticesToUpdate, boolean[] adjList); static void updateCliques(List<OpenBitSet> cliques, OpenBitSet newClique); boolean[][] getAdjacencyMatrix(); static boolean[][] cloneAdjacencyMarix(boolean[][] src); JunctionTree junctionTree(List<OpenBitSet> cliques, boolean init); JunctionTree junctionTree(Resource resource, String namespace, String name, List<OpenBitSet> cliques, boolean init); void mergeGraphs(SeparatorSet[][][] graphs, SeparatorSet separatorSet); int createJunctionTreeGraph(SeparatorSet[][] sepGraph, JunctionTreeClique parent, JunctionTreeClique[] jtNodes, JunctionTreeSeparator[] jtSeps, int i); void mapNodeToCliqueFamily(OpenBitSet[] varNodeToCliques, JunctionTreeClique[] jtNodes); void mapVarNodeToCliques(OpenBitSet[] nodeToCliques, int id, OpenBitSet clique); static List<Integer> getAdjacentVertices(boolean[][] adjacencyMatrix, int i);  }