% % % % \subsection{Linear-delay generation under cycle and depth restrictions} \label{rl:section} We give explicit linear-space constructions for several restricted classes of functional digraphs. The choice of representation is part of the statement. We use a recursive order of rooted trees, rather than requiring the particular tree-code order of \cite{DPT2024}. For prescribed numerical parameters the resulting delay is linear, including initialization and exhaustion. For an arbitrary set of accepted component parameters, we separate quadratic preprocessing from the subsequent linear delay. The decomposition into tree multisets, cyclic arrangements and component multisets is classical, including the generic iterator framework of Mart\'inez and Molinero \cite{MM2003,MM2004}. Restricted rooted-tree and partition generation also have substantial earlier literature \cite{Li1996,LR1999,RJ1976}. The proof obligation here is the particular uniform worst-case interface under simultaneous restrictions. It has three parts: a shape-independent completion test, constant-time selection of the next nonempty size--height class, and a copyable state whose size is proportional to the generated object. None follows merely from a CAT bound or from testing restrictions on an unrestricted stream. Throughout this section, a functional digraph has one outgoing arc at each vertex. A connected component consists of a directed cycle with a rooted tree attached at every cycle vertex; tree arcs point towards their roots. The \emph{depth} of a component is the maximum distance to its cycle, and the depth of a nonempty graph is the maximum of its component depths. We write $n$ for the number of vertices, $k$ for a component's cycle length, and $h$ for its depth. For a possibly disconnected graph, $K$ denotes the total number of cyclic vertices and $m$ its number of components. Time is measured on a word RAM with $\Theta(\log(n+2))$-bit words. When a shared index serves all sizes up to a larger cap $N$, the word size is instead $\Theta(\log(N+2))$; the local state still occupies $O(n)$ such words. Numerical parameters are word-sized. Unless preprocessing is explicitly separated, delay includes the time before the first output and after the last output. Working space excludes a read-only input and outputs retained by a consumer. The current output itself has linear size and may be included in the workspace bound. Empty graphs are handled separately when a maximum depth is prescribed. \subsubsection{A canonical order and the necklace interface} \label{rl:representation} For a rooted tree $T$, let $|T|$ and $\operatorname{ht}(T)$ denote its size and height. Define its order recursively by comparing \[ \bigl(|T|,\operatorname{ht}(T),\text{the nondecreasing sequence of children of }T\bigr) \] lexicographically. The children are themselves compared in the same recursive order. A tree is encoded by the preorder sequence of pairs $(|T_v|,\operatorname{ht}(T_v))$, with children in this order. Subtree sizes delimit every child code, so the encoding is unambiguous. Comparing two such preorder encodings gives precisely the recursive tree order: different sizes or heights are decided at the root, while equal root classes are decided by the first different child. Equal root sizes give equal code lengths, so no unresolved proper-prefix case occurs. Consequently this is a canonical rooted-tree representation of $2|T|$ words. A multiset of rooted trees is represented by its nondecreasing sequence in this order. A connected functional digraph is represented by the least rotation of its sequence of rooted-tree codes. As in the usual tree-decorated-cycle description of functional digraphs \cite{DPT2024}, two such components are isomorphic if and only if their sequences agree up to rotation. Reflections are not identified. For a disconnected graph we output its multiset of canonical components as a list in the deterministic order of the decomposition used below. Uniqueness follows from that decomposition; we perform no additional comparison sort of the entire graph. This is the output contract of the construction itself. The separate normalization in Theorem~\ref{thm:dpt-linear-original-normalization} can convert the graph to the original DPT whole-graph code in linear time and linear words, preserving these worst-case delay and word-space bounds. This observation does not preserve a CAT total, constant auxiliary space, or a bit-space bound for a different generator. We use the following precise interface of Theorem~\ref{thm:necklace-linear}. Given positive multiplicities $c_0,\ldots,c_{q-1}$ with sum $k$, the canonical fixed-content necklaces on the ordered alphabet $0,\ldots,q-1$ are generated exactly once. First output, successor, and exhaustion each take $O(k)$ time. A state consists of $O(k)$ explicitly stored words and can be copied in $O(k)$ time. A stateless successor is more than sufficient. This is a worst-case interface, not a constant-amortized-time assertion. The first-inversion structure underlying that theorem is due to Sawada and Williams \cite{SW2023}. \begin{lemma}[Linear alphabet construction] \label{rl:alphabet} Given a nondecreasing forest of total size $n$ in the recursive tree order, its distinct tree alphabet, multiplicities, and the correspondence from symbols to tree codes can be constructed in $O(n)$ time and space. \end{lemma} \begin{proof} The root-tree codes have total length $n$ pairs. Compare adjacent codes and start a new alphabet block precisely when they differ. A comparison costs at most the sum of the two code lengths, and every code participates in at most two comparisons. Thus all equality tests, code copying, and block bookkeeping cost $O(n)$. The codes are already sorted in the required alphabet order, so no sorting is needed. The multiplicities sum to the number of roots, which is at most $n$. \end{proof} \subsubsection{Exact forest feasibility} \label{rl:forest-feasibility} The forest generator uses size and height classes before recursively choosing the shapes within a class. A tree class $(a,g)$ is nonempty exactly when \begin{equation} \label{rl:tree-class} (a,g)=(1,0)\quad\hbox{or}\quad a\ge2,\quad 1\le g\le a-1. \end{equation} The second case is realized by a path of length $g$ from the root, with the remaining vertices added as leaves of the root. Let $y$ be an admissible lower-bound tree of size $s$ and height at most $b$. We ask for a nondecreasing sequence of exactly $j$ trees, all at least $y$, with total size $R$ and heights at most $b$. A Boolean flag $\eta$ specifies whether some tree must have height exactly $b$. Write $\Phi_b(R,j,s,\eta)$ for feasibility. Despite its definition using $y$, the answer depends only on $s$ and the displayed parameters. \begin{lemma}[Forest feasibility] \label{rl:phi} Negative remainders are infeasible. For $R\ge0$, \begin{align} \Phi_b(R,0,s,\eta) &\iff R=0\ \hbox{and}\ \neg\eta,\label{rl:phi-empty}\\ \Phi_0(R,j,s,\eta) &\iff s=1\ \hbox{and}\ R=j \qquad (j\ge1),\label{rl:phi-zero}\\ \Phi_b(R,j,s,\eta) &\iff \begin{aligned}[t] &js\le R\ \hbox{and}\\ &\bigl(\neg\eta\ \hbox{or}\ s\ge b+1\ \hbox{or}\ R-(j-1)s\ge\max(s+1,b+1)\bigr),\quad b,j\ge1. \end{aligned}\label{rl:phi-positive} \end{align} If the number of trees is unrestricted, write $\Phi_b^*(R,s,\eta)=\bigvee_{j\ge0}\Phi_b(R,j,s,\eta)$. Then \begin{align} \Phi_b^*(0,s,\eta)&\iff\neg\eta,\label{rl:phi-star-empty}\\ \Phi_0^*(R,s,\eta)&\iff s=1\qquad(R>0),\label{rl:phi-star-zero}\\ \Phi_b^*(R,s,\eta)&\iff R\ge s\ \hbox{and}\ (\neg\eta\ \hbox{or}\ R\ge b+1) \qquad(R,b>0).\label{rl:phi-star-positive} \end{align} All these tests take constant time. \end{lemma} \begin{proof} The empty case is immediate. Height zero permits only the one-vertex tree, proving~\eqref{rl:phi-zero}. Suppose $b,j\ge1$. Every tree has size at least $s$, so $R\ge js$ is necessary. If no maximum height is required, take $j-1$ copies of $y$ and one tree of size $R-(j-1)s$. When this last size equals $s$, use another copy of $y$; when it is larger, a star has height at most $b$ and exceeds $y$ by size. Sorting the chosen trees therefore gives a valid sequence. Now require height $b$. If $s\ge b+1$, a height-$b$ tree of size $s$ exists. It exceeds $y$ by height when $\operatorname{ht}(y)s$. The other $j-1$ trees require at least $(j-1)s$ vertices. This proves the necessary inequality in the final alternative of~\eqref{rl:phi-positive}, and the path-with-root- leaves construction proves sufficiency. These arguments do not depend on the shape of $y$. For unrestricted length, the case $R=0$ and the height-zero case are already settled. When $R,b>0$, any nonempty sequence needs $R\ge s$; requiring height $b$ also needs $R\ge b+1$. Conversely a single tree of size $R$ can be chosen at least $y$, with height $b$ if required, by the preceding constructions. This proves the starred formulas. \end{proof} \subsubsection{Tied generation and constant-time class selection} \label{rl:tied-search} For example, take height bound $b=2$, three remaining roots, and a lower tree $y$ of size two. If height two is required, total size six is impossible: three copies of the two-vertex path have height one. Total size seven is possible, using sizes $(2,2,3)$ and making the last tree a three-vertex path. This is the surplus alternative in \eqref{rl:phi-positive}. The test depends on the lower tree's size, not on a costly search through possible shapes. There are two mutually recursive tasks. A tree task generates all trees of a given nonempty class $(a,g)$, possibly subject to being at least a reference tree $Y$ of that same class. A sequence task generates a nondecreasing forest with remaining size $R$, root count $j$ (or $*$), height bound $b$, and requirement flag $\eta$. It has a previous tree as a lower bound and may be tied to a reference sequence of the same total size and satisfying the same constraints. A tie means that all earlier trees equal the corresponding reference trees. At a sequence position, use the next reference tree as the lower bound if the sequence is tied, and otherwise use its previous tree. If neither exists, the lower class is $(1,0)$. For a candidate class $(a,g)$ at least this lower class, test the tail using \begin{equation} \label{rl:tail-test} \Phi_b(R-a,j-1,a,\eta\mathbin{\wedge}(g