Building an undirected graph from depth-first sorted node list in Python
I believe you can get a similar result by creating and passing around an iterator on the nodes list:

def node_iterator(nodes, nit=None, parent=None):
    if nit is None:
        nit = iter(nodes)

    node = next(nit)
    yield (node, parent)

    for i in range(node.child_count):
        yield from node_iterator(nodes, nit, parent=node)