def _next_rooted_tree(predecessor, p=None):

    if p is None:
        p = len(predecessor) - 1
        while predecessor[p] == 1:
            p -= 1
    if p == 0:
        return None

    q = p - 1
    while predecessor[q] != predecessor[p] - 1:
        q -= 1
    result = list(predecessor)
    for i in range(p, len(result)):
        result[i] = result[i - p + q]
    return result
.. todo::
dataset/ETHPy150Open networkx/networkx/networkx/generators/nonisomorphic_trees.py/_next_rooted_tree--crossover with--dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/sandbox/cuda_convnet/probabilistic_max_pooling.py/ProbMaxPool.c_headers