The algebra of reversible Markov chains