Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/inference/static/@jtree_sparse_inf_engine/clq_containing_nodes.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 c = clq_containing_nodes(engine, nodes, fam) | |
2 % CLQ_CONTAINING_NODES Find the lightest clique (if any) that contains the set of nodes | |
3 % c = clq_containing_nodes(engine, nodes, family) | |
4 % | |
5 % If the optional 'family' argument is specified, it means nodes = family(nodes(end)). | |
6 % (This is useful since clq_ass_to_node is not accessible to outsiders.) | |
7 % Returns c=-1 if there is no such clique. | |
8 | |
9 if nargin < 3, fam = 0; else fam = 1; end | |
10 | |
11 if length(nodes)==1 | |
12 c = engine.clq_ass_to_node(nodes(1)); | |
13 %elseif fam | |
14 % c = engine.clq_ass_to_node(nodes(end)); | |
15 else | |
16 B = engine.cliques_bitv; | |
17 w = engine.clique_weight; | |
18 clqs = find(all(B(:,nodes), 2)); % all selected columns must be 1 | |
19 if isempty(clqs) | |
20 c = -1; | |
21 else | |
22 c = clqs(argmin(w(clqs))); | |
23 end | |
24 end |