'Computes the rank of a Prufer sequence.
Examples
>>> from sympy.combinatorics.prufer import Prufer
>>> a = Prufer([[0, 1], [0, 2], [0, 3]])
>>> a.prufer_rank()
0
See Also
rank, next, prev, size'

def prufer_rank(self):

    r = 0
    p = 1
    for i in range((self.nodes - 3), (-1), (-1)):
        r += (p * self.prufer_repr[i])
        p *= self.nodes
    return r
