Python and MATLAB implementation of algorithm 7.2.1.6.R in Knuth's volume 4, fascicle 4, on generating all trees.