Maintain a FIFO queue of child iterators ordered by the breadth-first order of their parents. Consume a child from the front iterator and append a deferred iterator for that child's children; discard empty front iterators as needed. This enumerates descendants without first materializing a whole child list or level. On a locally finite tree, each node occurs after finitely many earlier outputs. If an earlier level is infinite, strict breadth-first order cannot put a deeper node at any finite output position; that obstruction is inherent in the requested ordering.
Articles by others on the same topic
There are currently no matching articles.