Daniel@0: function gdl = bnet_to_gdl_graph(bnet) Daniel@0: % BNET_TO_GDL_GRAPH Convert a Bayesian network to a GDL graph Daniel@0: % gdl = bnet_to_gdl_graph(bnet) Daniel@0: % Daniel@0: % Each node in the BN gets converted to a single node in the GDL graph, Daniel@0: % representing its family; its kernel function is the corresponding CPD. Daniel@0: Daniel@0: N = length(bnet.dag); Daniel@0: doms = cell(1,N); Daniel@0: for i=1:N Daniel@0: doms{i} = family(bnet.dag, i); Daniel@0: end Daniel@0: Daniel@0: U = mk_undirected(bnet.dag); Daniel@0: gdl = mk_gdl_graph(U, doms, bnet.node_sizes, bnet.CPD, 'equiv_class', bnet.equiv_class, ... Daniel@0: 'discrete', bnet.dnodes, 'chance', bnet.chance_nodes, ... Daniel@0: 'decision', bnet.decision_nodes, 'utility', bnet.utility_nodes); Daniel@0: