To solve a problem at work, I need to write an algorithm that will find the limit of a user-submitted Markov chain. The Wikipedia page on Markov chains says
Because there are a number of different special cases to consider, the process of finding this limit if it exists can be a lengthy task
Wikipedia then goes on to explain that some Markov chain limits can be found using the formula
$$Q=f(0_{n,n})[f(P-I_n)]^{-1}$$
where
$P \equiv$ the transition matrix
$Q = \lim_{k\to\infty} P^k$
$f(A) \equiv$ a function that returns the matrix $A$ with its right-most column replaced with all 1's.
However, this approach doesn't work if $[f(P-I_n)]^{-1}$ doesn't exist, and Wikipedia doesn't explain how to find the limit in that case.
From the research I've done, I think the $Q=f(0_{n,n})[f(P-I_n)]^{-1}$ approach fails only when the Markov chain is reducible, and the solution is to break the transition matrix into irreducible parts by identifying its communicating classes. However, I'm only guessing; I haven't yet found a reference that spells out a general procedure for finding the limit of a Markov chain. Can anyone point me in the right direction?
P.S. My work problem involves identifying the crude oils flowing into an oil refinery, after flowing through various tanks, and after being labeled and re-labeled through various accounting systems. I have verified that the $Q=f(0_{n,n})[f(P-I_n)]^{-1}$ approach fails for actual Markov chains my application must handle.
P.P.S. I am aware that my question may be regarded as a duplicate of this question, but the only answer to that question is wrong, and after seven years I don't think a better answer is going to be posted there.
Edit:
In the comments, saulspatz asked why I was interested in the limit ($\lim_{k\to\infty} P^k$), and not the stationary distribution. My answer is too long for a comment, so I'm posting it here.
My Markov chain is really just a mapping from one set of crude oil identifying codes to another set of crude oil identifying codes. I need to reapply the mapping until all codes are resolved to the most primitive level. Each successive multiplication does not represent a step in time; it represents a conceptual reversal of one of the mixing or re-categorizing steps the material went through on its way from the well to the plant. In the end, $\lim_{k\to\infty} P^k$ is a translation table from all possible codes to the primitive codes I'm interested in. It will remain static for perhaps a month, and during that period I will be multiplying it by each day's record of the refinery receipts to get the data set for that day. Under this scenario, I believe $\lim_{k\to\infty} P^k$ is relevant, not the stationary distribution.