Solution (source code)

= Solution

Let $D_i$ be the <degree of a vertex> and put
$$
\pi_i=\frac{D_i}{\sum_kD_k}.
$$
If $i$ and $j$ are adjacent, then $\pi_ip_{ij}=1/\sum_kD_k=\pi_jp_{ji}$; if they are not adjacent, both sides vanish. Thus the walk is in detailed balance, and its invariant distribution is \b[proportional to vertex degree].