added function to calculate state distribution from network states, added test
fixed bug in simulate