annotate toolboxes/FullBNT-1.0.7/graph/test_strong_root.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function strong = test_strong_root(jtree,cliques,dnodes,root)
Daniel@0 2 % This function tests, whether root is a strong root of jtree.
Daniel@0 3 % The following parameters are used
Daniel@0 4 % Input:
Daniel@0 5 % jtree An matrix with two colums. jtree(i,j) == jtree(j,i) is 1 if node
Daniel@0 6 % i is connected with node j
Daniel@0 7 % cliques Cells which contain the nodes in each clique
Daniel@0 8 % dnodes An array with the discrete nodes of the juntion tree.
Daniel@0 9 % root It is tested whether root is the strong root of the junction tree
Daniel@0 10 % Output:
Daniel@0 11 % strong The output is 1 if root is the strong root of the junction tree jtree.
Daniel@0 12 % Please note, that the running intersection property is not tested.
Daniel@0 13 if isempty(dnodes)
Daniel@0 14 strong = 1;
Daniel@0 15 return;
Daniel@0 16 end
Daniel@0 17
Daniel@0 18 children = find(jtree(root,:)==1);
Daniel@0 19 i = 1;
Daniel@0 20 strong = 1;
Daniel@0 21 while (i <= length(children)) & (strong==1)
Daniel@0 22 child = children(i);
Daniel@0 23 jtree(child,root) = 0;
Daniel@0 24 jtree(root,child) = 0;
Daniel@0 25 sep = myintersect(cliques{child},cliques{root});
Daniel@0 26 diff = mysetdiff(cliques{child},cliques{root});
Daniel@0 27 if (mysubset(sep,dnodes) | isempty(myintersect(diff,dnodes)))
Daniel@0 28 strong = test_strong_root(jtree,cliques,dnodes,child);
Daniel@0 29 else
Daniel@0 30 strong = 0;
Daniel@0 31 end;
Daniel@0 32 i = i+1;
Daniel@0 33 end
Daniel@0 34