Operator Algebra for Stochastic Dynamics and the Heisenberg Chain