#include "comb/tree-lev-seq.h"
#include "comb/word-stats.h"
#include "comb/comb-print.h"
#include "fxtio.h"
#include "fxttypes.h"
#include "jjassert.h"
#include "nextarg.h"
//% Statistics for (level sequences of) unordered rooted trees.
//% Cf. the following OEIS sequences:
//% A000081: all trees.
//% A034781: trees by height.
//% A033185: forests by number of trees.
//% A244372: trees by max branching number (out-degree).
//% A244454: trees by min branching number (out-degree) of non-leaf nodes.
// Cf. comb/ordered-tree-lev-seq-stats-demo.cc for stats for ordered trees
//#define TIMING // uncomment to disable printing
int
main(int argc, char **argv)
{
ulong n = 6;
NXARG(n, "Number of non-root nodes");
ulong sq = 0;
NXARG(sq, "Select stats:\n"
" 0 ==> by height\n"
" 1 ==> number of ascents\n"
" 2 ==> number of descents\n"
" 3 ==> number of ones\n"
// " 4 ==> number of fixed points\n" // same stats as 0
" 5 ==> number of maximal levels\n"
" 6 ==> position of last occurrence of one\n"
// " 7 ==> position of first occurrence of the maximal value\n" // same stats as 0
" 8 ==> position of last occurrence of the maximal value\n"
// " 9 ==> number of flat steps\n"
" 10 ==> number of even values\n"
" 11 ==> number of odd values\n"
" 20 ==> number of flat steps\n"
" 21 ==> number of non-flat steps\n"
" 25 ==> number of peaks\n"
// " 11 ==> number of \n"
);
bool aa = false; // whether to print as ASCII art
NXARG(aa,"Whether to render trees as ASCII art");
tree_lev_seq T(n);
word_stats W(T.data(), T.size());
ulong ct = 0;
ulong * st = new ulong[n+1]; // stats
for (ulong k=0; k