annotate 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
rev   line source
wolffd@0 1 function gdl = bnet_to_gdl_graph(bnet)
wolffd@0 2 % BNET_TO_GDL_GRAPH Convert a Bayesian network to a GDL graph
wolffd@0 3 % gdl = bnet_to_gdl_graph(bnet)
wolffd@0 4 %
wolffd@0 5 % Each node in the BN gets converted to a single node in the GDL graph,
wolffd@0 6 % representing its family; its kernel function is the corresponding CPD.
wolffd@0 7
wolffd@0 8 N = length(bnet.dag);
wolffd@0 9 doms = cell(1,N);
wolffd@0 10 for i=1:N
wolffd@0 11 doms{i} = family(bnet.dag, i);
wolffd@0 12 end
wolffd@0 13
wolffd@0 14 U = mk_undirected(bnet.dag);
wolffd@0 15 gdl = mk_gdl_graph(U, doms, bnet.node_sizes, bnet.CPD, 'equiv_class', bnet.equiv_class, ...
wolffd@0 16 'discrete', bnet.dnodes, 'chance', bnet.chance_nodes, ...
wolffd@0 17 'decision', bnet.decision_nodes, 'utility', bnet.utility_nodes);
wolffd@0 18