Mercurial > hg > camir-aes2014
diff toolboxes/FullBNT-1.0.7/bnt/general/Old/bnet_to_gdl_graph.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolboxes/FullBNT-1.0.7/bnt/general/Old/bnet_to_gdl_graph.m Tue Feb 10 15:05:51 2015 +0000 @@ -0,0 +1,18 @@ +function gdl = bnet_to_gdl_graph(bnet) +% BNET_TO_GDL_GRAPH Convert a Bayesian network to a GDL graph +% gdl = bnet_to_gdl_graph(bnet) +% +% Each node in the BN gets converted to a single node in the GDL graph, +% representing its family; its kernel function is the corresponding CPD. + +N = length(bnet.dag); +doms = cell(1,N); +for i=1:N + doms{i} = family(bnet.dag, i); +end + +U = mk_undirected(bnet.dag); +gdl = mk_gdl_graph(U, doms, bnet.node_sizes, bnet.CPD, 'equiv_class', bnet.equiv_class, ... + 'discrete', bnet.dnodes, 'chance', bnet.chance_nodes, ... + 'decision', bnet.decision_nodes, 'utility', bnet.utility_nodes); +