Let $P$ be a transition matrix of a time-homogeneous Markov chain with at least one closed communication class.
Is there an algorithm / optimization problem that outputs the identification of the communication classes? For example, if $$P=\left(\begin{matrix} 0.5 &0 &0.5 &0 \\ 0 &0.5 &0 &0.5 \\ 0.5 &0 &0.5 &0 \\ 0 &0.5 &0 &0.5 \end{matrix}\right)$$ Then the output will be $(1,3),(2,4)$.
Thank you.