annotate toolboxes/FullBNT-1.0.7/graph/findroot.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 root = findroot(bnet, cliques)
Daniel@0 2
Daniel@0 3 %% findroot is to find the strong root in a clique tree assume it has one
Daniel@0 4 %% in the tree. For a clique tree constructed from a strongly triangulated
Daniel@0 5 %% graph, an interface clique that contains all discrete parents
Daniel@0 6 %% and at least one continuous node from a connected continuous component
Daniel@0 7 %% is for sure to be available as a guaranteed strong root.
Daniel@0 8 %% -By Wei Sun, George Mason University, 4/17/2010.
Daniel@0 9
Daniel@0 10 %% We choose the interface clique that contains the max number
Daniel@0 11 %% of interface nodes to be the strong root.
Daniel@0 12 n0 = 0 ;
Daniel@0 13 for i=1:length(cliques)
Daniel@0 14 % check hybrid cliques
Daniel@0 15 hc = intersect(cliques{i}, bnet.cnodes) ;
Daniel@0 16 hd = intersect(cliques{i}, bnet.dnodes) ;
Daniel@0 17 if ~isempty(hd) & ~isempty(hc)
Daniel@0 18 nd = length(hd) ;
Daniel@0 19 if nd > n0
Daniel@0 20 root = i ;
Daniel@0 21 n0 = nd ;
Daniel@0 22 end
Daniel@0 23 end
Daniel@0 24 end