def random_walk_step(r, p0, W, pt):
    """
    r = probability of restart
    p0 = initial probability vector
    W = column-normalized adjacency matrix
    pt = probability vector at time step t
    pt = probability vector at time step t + 1
    """
    #print 'r', r
    #print 'W', W
    #print 'pt', pt
    #print 'p0', p0
    #pt1 = (1 - r) * W.dot(pt) + r * p0
    pt1 = (1 - r) * W * pt + r * p0
    return pt1