Daniel@0: function check_jtree_property(cliques_containing_node, jtree) Daniel@0: % CHECK_JTREE_PROPERTY Raise an error if the graph does not satisfy the join tree property. Daniel@0: % check_jtree_property(cliques_containing_node, jtree_adj_mat) Daniel@0: % Daniel@0: % The join tree property says: Daniel@0: % For each node n in the dag, compute the node-induced subgraph G by looking at all the cliques Daniel@0: % that contain n, and make sure G forms a connected graph. Daniel@0: % This ensures that local propagation leads to global consistency. Daniel@0: Daniel@0: num_bn_nodes = length(cliques_containing_node); Daniel@0: directed = 0; Daniel@0: for i=1:num_bn_nodes Daniel@0: cs = cliques_containing_node{i}; Daniel@0: G = jtree(cs,cs); Daniel@0: if ~connected_graph(G, directed) Daniel@0: error(['node ' num2str(i) ' violates jtree property']); Daniel@0: end Daniel@0: end