function nodes = getchildren(tree, node)
%
% nodes = getchildren(tree, node);
%  Input:  tree is a struct with the parent structure:
%      tree.parent
%           node = index of parent node.
%
%  Output: the list of all the nodes that are bellow (children) the 'node'

nodes = find(tree.parent==node);
for i = 1:length(nodes)
    nodes_i = getchildren(tree, nodes(i));
    nodes = [nodes nodes_i];
end

