To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _FullBNT / BNT / general / Old / bnet_to_gdl_graph.m @ 8:b5b38998ef3b

History | View | Annotate | Download (624 Bytes)

1
function gdl = bnet_to_gdl_graph(bnet)
2
% BNET_TO_GDL_GRAPH Convert a Bayesian network to a GDL graph
3
% gdl = bnet_to_gdl_graph(bnet)
4
%
5
% Each node in the BN gets converted to a single node in the GDL graph,
6
% representing its family; its kernel function is the corresponding CPD.
7

    
8
N = length(bnet.dag);
9
doms = cell(1,N);
10
for i=1:N
11
  doms{i} = family(bnet.dag, i);
12
end
13

    
14
U = mk_undirected(bnet.dag);
15
gdl = mk_gdl_graph(U, doms, bnet.node_sizes, bnet.CPD, 'equiv_class', bnet.equiv_class, ...
16
		   'discrete', bnet.dnodes, 'chance', bnet.chance_nodes, ...
17
		   'decision', bnet.decision_nodes, 'utility', bnet.utility_nodes);
18