function [prior, transmat, obsmat, obsmat1] = dbn_to_hmm(bnet)
% Compute the HMM parameters from the DBN.
% [prior, transmat, obsmat, obsmat1] = dbn_to_hmm(bnet)

observed = bnet.observed_slice;
assert(canonical_dbn(bnet.intra, bnet.inter, observed));

ss = bnet.slice_size;
hidden = setdiff(1:ss, observed);
node_sizes = bnet.node_sizes;

prior = mk_hmm_matrix(bnet, [], hidden);
prior = prior(:)';
transmat = mk_hmm_matrix(bnet, hidden, hidden+ss);
obsmat1 = mk_hmm_matrix(bnet, hidden, observed);
obsmat = mk_hmm_matrix(bnet, hidden+ss, observed+ss);

% obsmat1 = obsmat if the observation matrices are tied across slices

