by Samuel Cure, Florian G. Pflug, Simone PigolottiEpidemic models on complex networks are widely used to assess how the social structure of a population affects epidemic spreading. However, their numerical simulation can be computationally heavy, especially for large networks. In this paper, we introduce NEXT-Net: a flexible implementation of the next reaction method for simulating epidemic spreading on both static and temporal weighted networks. We find that NEXT-Net is substantially faster than alternative algorithms, while being exact. It permits, in particular, to efficiently simulate epidemics on networks with millions of nodes on a standard computer. It also permits simulating a broad range of epidemic models on temporal networks, including scenarios in which the network structure changes in response to the epidemic. NEXT-Net is implemented in C++ and accessible from Python and R, thus combining speed with user friendliness. These features make our algorithm an ideal tool for a broad range of applications.