annotate toolboxes/FullBNT-1.0.7/graph/children.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function cs = children(adj_mat, i, t)
wolffd@0 2 % CHILDREN Return the indices of a node's children in sorted order
wolffd@0 3 % c = children(adj_mat, i, t)
wolffd@0 4 %
wolffd@0 5 % t is an optional argument: if present, dag is assumed to be a 2-slice DBN
wolffd@0 6
wolffd@0 7 if nargin < 3
wolffd@0 8 cs = find(adj_mat(i,:));
wolffd@0 9 else
wolffd@0 10 if t==1
wolffd@0 11 cs = find(adj_mat(i,:));
wolffd@0 12 else
wolffd@0 13 ss = length(adj_mat)/2;
wolffd@0 14 j = i+ss;
wolffd@0 15 cs = find(adj_mat(j,:)) + (t-2)*ss;
wolffd@0 16 end
wolffd@0 17 end