wolffd@0: function root = findroot(bnet, cliques) wolffd@0: wolffd@0: %% findroot is to find the strong root in a clique tree assume it has one wolffd@0: %% in the tree. For a clique tree constructed from a strongly triangulated wolffd@0: %% graph, an interface clique that contains all discrete parents wolffd@0: %% and at least one continuous node from a connected continuous component wolffd@0: %% is for sure to be available as a guaranteed strong root. wolffd@0: %% -By Wei Sun, George Mason University, 4/17/2010. wolffd@0: wolffd@0: %% We choose the interface clique that contains the max number wolffd@0: %% of interface nodes to be the strong root. wolffd@0: n0 = 0 ; wolffd@0: for i=1:length(cliques) wolffd@0: % check hybrid cliques wolffd@0: hc = intersect(cliques{i}, bnet.cnodes) ; wolffd@0: hd = intersect(cliques{i}, bnet.dnodes) ; wolffd@0: if ~isempty(hd) & ~isempty(hc) wolffd@0: nd = length(hd) ; wolffd@0: if nd > n0 wolffd@0: root = i ; wolffd@0: n0 = nd ; wolffd@0: end wolffd@0: end wolffd@0: end