Created serialization and deserialization for markovchains.