wolffd@0: function cs = children(adj_mat, i, t) wolffd@0: % CHILDREN Return the indices of a node's children in sorted order wolffd@0: % c = children(adj_mat, i, t) wolffd@0: % wolffd@0: % t is an optional argument: if present, dag is assumed to be a 2-slice DBN wolffd@0: wolffd@0: if nargin < 3 wolffd@0: cs = find(adj_mat(i,:)); wolffd@0: else wolffd@0: if t==1 wolffd@0: cs = find(adj_mat(i,:)); wolffd@0: else wolffd@0: ss = length(adj_mat)/2; wolffd@0: j = i+ss; wolffd@0: cs = find(adj_mat(j,:)) + (t-2)*ss; wolffd@0: end wolffd@0: end