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