How can I count clockwise vs counterclockwise cycles in a series of (modular) integers?

303 Views Asked by At

I'm working with a Markov process that has a state and transition diagram like in the picture:

six-state cyclical reversible markov chain

The transition probabilities are not listed, but they are always positive, but not necessarily equal. When I simulate my system, I'll get a random sequence of states like this: $$\{1,2,3,4,3,2,3,4,5,4,5,6,1,2,3,2,1,2,3,4,5,6...\}$$

Say my original state is $1$. Clearly if I start at $1$, I can wind up back at $1$, but for my purposes, how I do so matters.

I'm modeling a biological process, so if I make a cycle $\{1,2,3,4,5,6,1\}$ clockwise, I turn energy into a biomolecule, while if I go counterclockwise: $\{1,6,5,4,3,2,1\}$, I do the opposite. If I just go $\{1,2,3,2,1\}$ I get nothing.

Given a long sequence of states, I want to know the net number of clockwise cycles I make: $$N_{net} = N_{clockwise} - N_{counterclockwise}$$

Any ideas?

1

There are 1 best solutions below

1
On

Instead of thinking you have $6$ states, pretend you have infinitely many states and that from state $k$ you can either go to $k+1$ or $k-1$.

Then your final state is $k \mod 6$ and $N_{net} = \lfloor k/6 \rfloor$.

EDIT: The above formula for $N_{net}$ does not work for $k < 0$. If $k < 0$, $N_{net} = \lceil k/6 \rceil$.