Simulation of stochastic network dynamics