A Markov chain with row-stochastic transition matrix settles into a stationary distribution with and .
Implement:
stationary(P): solve the linear system exactly (replace one equation of with the normalisation constraint)power_iteration(P, iters=1000): start from the uniform distribution and repeatedly apply