function AI_dump_tree(nodes,attributes)
%
% AI_dump_tree - print out decision tree
% Call:
%     AI_dump_tree(nodes);
% On input:
%     nodes (structure array): nodes of tree
% On output:
%     print of node values ()
% Custom functions used:
%     none
% Author:
%     T. Henderson, UU, 11/2002
% Method:
%

num_nodes = length(nodes);
for n = 1:num_nodes
   fprintf(1,' ----- node: %d \n', n);
   if nodes(n).type==1
      fprintf(1,'    Name: %s \n',...
         attributes(nodes(n).value).name);
   else
      fprintf(1,'    Value: %d \n',nodes(n).value);
   end
   
   fprintf(1,'     Type: %d \n',nodes(n).type);
   fprintf(1,'   Parent: %d \n',nodes(n).parent);
   fprintf(1,'   Gain: %d \n',nodes(n).gain);
   fprintf(1,' Children:  \n');
   if nodes(n).type==1
      for v = 0:length(nodes(n).children)-1
         fprintf(1,' %d ',nodes(n).children(v+1));
      end
      fprintf(1,'\n');
   end
end
