function res = isleaf(node)
% Test whether a node is a leaf
res = ~isfield(node,'branches') | isempty(node.branches); 
%!! To handle cases where the node is improperly formed,
%!! test whether \code{branches} is a field name of \code{node}
