msmbuilder.MSMLib.ergodic_trim

msmbuilder.MSMLib.ergodic_trim(counts, assignments=None)[source]

Use Tarjan’s Algorithm to find maximal strongly connected subgraph.

Parameters:

counts : sparse matrix (csr is best)

transition counts

assignments : ndarray, optional

Optionally map assignments to the new states, nulling out disconnected regions.

Returns :

—- :

trimmed_counts : lil sparse matrix

transition counts after ergodic trimming

mapping : ndarray

mapping[i] = j maps from untrimmed state index i to trimmed state index j, or mapping[i] = -1 if state i was trimmed

See also

Tarjan

Notes

The component with maximum number of counts is selected

Versions