# Plotting absorbing state probabilities from state 1

I have the following transition matrix:

\[ScriptCapitalP] = DiscreteMarkovProcess[1, {{0., 0.5, 0., 0., 0.5, 0., 0., 0., 0., 0.}, {0., 0., 0.5, 0., 0., 0.5, 0., 0., 0., 0.}, {0., 0., 0., 0.5, 0., 0., 0.5, 0., 0., 0.}, {0., 0., 0., 1., 0., 0., 0., 0., 0., 0.}, {0., 0., 0., 0., 0., 0.5, 0., 0.5, 0., 0.}, {0., 0., 0., 0., 0., 0., 0.5, 0., 0.5, 0.}, {0., 0., 0., 0., 0., 0., 1., 0., 0., 0.}, {0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0.5}, {0., 0., 0., 0., 0., 0., 0., 0., 1., 0.}, {0., 0., 0., 0., 0., 0., 0., 0., 0., 1.}}]


Visually, it looks as shown at the bottom.

Looking at the graph, I can see the absorbing states easily, and I can calculate individual probabilities of reaching a particular absorbing state from state 1. For example, from state 1 to state 9:

PDF[\[ScriptCapitalP][∞], 9]


However, this manual process is hardly practical with larger matrices.

So, what I wish to achieve is an automatic computation of all absorbing state probabilities from state 1, so that I can finally plot these.

How might that be achieved?

You can use MarkovProcessProperties

absorbingStateProbs1[p_] := Extract @@ (MarkovProcessProperties[
p, #] & /@ {"ReachabilityProbability", "AbsorbingClasses"});

absorbingStateProbs1@\[ScriptCapitalP]


{0.125, 0.375, 0.375, 0.125}

Alternatively,

absorbingStateProbs2[p_] := PDF[p[∞], #] & /@
Flatten[MarkovProcessProperties[p, "AbsorbingClasses"]]

absorbingStateProbs2@\[ScriptCapitalP]


{0.125, 0.375, 0.375, 0.125}