Sequences pre-order, post-order, rows, up ascend (Prüfer), up queue,
down queue, subtree height, subtree sizes, blob, successive paths,
Make some specific trees. Random labelled, preorder, downwards.
Counts of various trees, forests, or properties.
Least child monk, hereditary least single, strongly monotone, equaldepths.
Vertices are numbered 1 to n. A tree is a vector "vpar" where
vpar[v] is parent of v, or 0 if no
parent. Such a representation is oriented in that there is a distinguished
root (or roots for a forest) and labelled in that each vertex has a particular
number. There are no other attributes etc.
The main use is to calculate or verify properties of specific trees of
interest. Various functions like diameter are the same for any root or
labelling so effectively act as on a "free" tree and the vertex numbers just
for tree creation. Most functions are linear in the number of vertices so can
be used on large trees.
Connections to Pari/GP specifics include polynomials for roots (spectra),
matrices for some linear algebra, Set()s for independent sets,
permutations in relabelling and automorphisms, and then general compactness of
GP for experimenting etc.
Just vpar.gp is enough to run. Comments at the start give an
introduction and overview, then each function has an addhelp().
The tar file includes some example scripts, self-tests, and
work-in-progress extras. The extras mostly work but may change wildly. The
sig files are Gnu PG ascii armoured
signatures generated from my key.
The examples include bits of
Count preorder forests by footprint exercise from
Equal01 towards balanced by several authors, realizing the Chung-Feller
Equimatchable tree counts and generating functions.
Integral trees (integer adjacency spectrum) by diameter per
Isomorphic halves trees.
Maximal asymmetric subtrees per
Most maximum matchings per
Parking function to labelled forest per
Path lengths determinants per
Perm to upwards per
Random decorated binary tree per
See also gentreeg in the
Nauty tools which can generate
free trees in vertex parent form, and other forms, and can be used command
line or C.