I am doing some simulations for simple random walks on directed random graphs. From a graph of n vertices, I get a n by n transition probability matrix transit, with 2 n non-zero entries. I would like to compute the stationary distribution pi (a vector of n non-negative entries which sum to one), such that pi * transit == pi.
Currently, I found two ways to do this. The first is to use NullSpace.
eigenVector=First[NullSpace[N[transit]-IdentityMatrix[n]]];
pi=eigenVector/Total[eigenVector]
The second is to define a Markov Process directly on the underline graph g and use StationaryDistribution as follows.
n=VertexCount[g];
mp=DiscreteMarkovProcess[1,g];
stationary=StationaryDistribution[mp];
pi=NProbability[x==#,x\[Distributed]stationary]&/@Range[n]
Both methods can handle about n = 2000 on my laptop. But I would really like to compute this for a bit higher n. Any suggestions?
Update: For example g and transit with 1000, 2000, 3000 and 4000 nodes, see this link.
transitto numeric values before callingNullSpace. I have updated the code. – NonalcoholicBeer Nov 13 '20 at 17:14n. – NonalcoholicBeer Nov 14 '20 at 09:57