wolffd@0: function strong = test_strong_root(jtree,cliques,dnodes,root) wolffd@0: % This function tests, whether root is a strong root of jtree. wolffd@0: % The following parameters are used wolffd@0: % Input: wolffd@0: % jtree An matrix with two colums. jtree(i,j) == jtree(j,i) is 1 if node wolffd@0: % i is connected with node j wolffd@0: % cliques Cells which contain the nodes in each clique wolffd@0: % dnodes An array with the discrete nodes of the juntion tree. wolffd@0: % root It is tested whether root is the strong root of the junction tree wolffd@0: % Output: wolffd@0: % strong The output is 1 if root is the strong root of the junction tree jtree. wolffd@0: % Please note, that the running intersection property is not tested. wolffd@0: if isempty(dnodes) wolffd@0: strong = 1; wolffd@0: return; wolffd@0: end wolffd@0: wolffd@0: children = find(jtree(root,:)==1); wolffd@0: i = 1; wolffd@0: strong = 1; wolffd@0: while (i <= length(children)) & (strong==1) wolffd@0: child = children(i); wolffd@0: jtree(child,root) = 0; wolffd@0: jtree(root,child) = 0; wolffd@0: sep = myintersect(cliques{child},cliques{root}); wolffd@0: diff = mysetdiff(cliques{child},cliques{root}); wolffd@0: if (mysubset(sep,dnodes) | isempty(myintersect(diff,dnodes))) wolffd@0: strong = test_strong_root(jtree,cliques,dnodes,child); wolffd@0: else wolffd@0: strong = 0; wolffd@0: end; wolffd@0: i = i+1; wolffd@0: end wolffd@0: