Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/graph/test_strong_root.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
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 |