annotate toolboxes/FullBNT-1.0.7/graph/findroot.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function root = findroot(bnet, cliques)
wolffd@0 2
wolffd@0 3 %% findroot is to find the strong root in a clique tree assume it has one
wolffd@0 4 %% in the tree. For a clique tree constructed from a strongly triangulated
wolffd@0 5 %% graph, an interface clique that contains all discrete parents
wolffd@0 6 %% and at least one continuous node from a connected continuous component
wolffd@0 7 %% is for sure to be available as a guaranteed strong root.
wolffd@0 8 %% -By Wei Sun, George Mason University, 4/17/2010.
wolffd@0 9
wolffd@0 10 %% We choose the interface clique that contains the max number
wolffd@0 11 %% of interface nodes to be the strong root.
wolffd@0 12 n0 = 0 ;
wolffd@0 13 for i=1:length(cliques)
wolffd@0 14 % check hybrid cliques
wolffd@0 15 hc = intersect(cliques{i}, bnet.cnodes) ;
wolffd@0 16 hd = intersect(cliques{i}, bnet.dnodes) ;
wolffd@0 17 if ~isempty(hd) & ~isempty(hc)
wolffd@0 18 nd = length(hd) ;
wolffd@0 19 if nd > n0
wolffd@0 20 root = i ;
wolffd@0 21 n0 = nd ;
wolffd@0 22 end
wolffd@0 23 end
wolffd@0 24 end