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