annotate toolboxes/FullBNT-1.0.7/bnt/general/Old/bnet_to_gdl_graph.m @ 0:cc4b1211e677
tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author |
Daniel Wolff |
date |
Fri, 19 Aug 2016 13:07:06 +0200 |
parents |
|
children |
|
rev |
line source |
Daniel@0
|
1 function gdl = bnet_to_gdl_graph(bnet)
|
Daniel@0
|
2 % BNET_TO_GDL_GRAPH Convert a Bayesian network to a GDL graph
|
Daniel@0
|
3 % gdl = bnet_to_gdl_graph(bnet)
|
Daniel@0
|
4 %
|
Daniel@0
|
5 % Each node in the BN gets converted to a single node in the GDL graph,
|
Daniel@0
|
6 % representing its family; its kernel function is the corresponding CPD.
|
Daniel@0
|
7
|
Daniel@0
|
8 N = length(bnet.dag);
|
Daniel@0
|
9 doms = cell(1,N);
|
Daniel@0
|
10 for i=1:N
|
Daniel@0
|
11 doms{i} = family(bnet.dag, i);
|
Daniel@0
|
12 end
|
Daniel@0
|
13
|
Daniel@0
|
14 U = mk_undirected(bnet.dag);
|
Daniel@0
|
15 gdl = mk_gdl_graph(U, doms, bnet.node_sizes, bnet.CPD, 'equiv_class', bnet.equiv_class, ...
|
Daniel@0
|
16 'discrete', bnet.dnodes, 'chance', bnet.chance_nodes, ...
|
Daniel@0
|
17 'decision', bnet.decision_nodes, 'utility', bnet.utility_nodes);
|
Daniel@0
|
18
|