To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _FullBNT / BNT / graph / test_strong_root.m @ 8:b5b38998ef3b

History | View | Annotate | Download (1.19 KB)

1
function strong = test_strong_root(jtree,cliques,dnodes,root)
2
% This function tests, whether root is a strong root of jtree. 
3
% The following parameters are used
4
% Input:
5
% jtree   An matrix with two colums. jtree(i,j) == jtree(j,i) is 1 if node 
6
%         i is connected with node j
7
% cliques Cells which contain the nodes in each clique
8
% dnodes  An array with the discrete nodes of the juntion tree.
9
% root    It is tested whether root is the strong root of the junction tree
10
% Output:
11
% strong  The output is 1 if root is the strong root of the junction tree jtree.
12
%         Please note, that the running intersection property is not tested. 
13
if isempty(dnodes)
14
     strong = 1;
15
     return;
16
end
17

    
18
children = find(jtree(root,:)==1);
19
i = 1;
20
strong = 1;
21
while (i <= length(children)) & (strong==1)
22
     child = children(i);
23
     jtree(child,root) = 0;
24
     jtree(root,child) = 0;
25
     sep = myintersect(cliques{child},cliques{root});
26
     diff = mysetdiff(cliques{child},cliques{root});
27
     if (mysubset(sep,dnodes) | isempty(myintersect(diff,dnodes)))
28
         strong = test_strong_root(jtree,cliques,dnodes,child);
29
     else
30
         strong = 0;
31
     end;
32
     i = i+1;
33
end
34