Hi graphtool community! In this period I am stuck in a timing problem. I need to execute this function:
def *evolutionSIR*(G, ep_beta, count, v0): state = SIRState(G, beta=ep_beta, gamma=gamma, v0=v0, constant_beta=True) s = state.get_state() temp_state = np.zeros((count + 1, G.num_vertices()), dtype=int) temp_state[0, :] = s.a[:] for i in range(count): state.iterate_sync() s = state.get_state() temp_state[i + 1, :] = s.a[:] return temp_state After this, I use a fuction to determine the timestep where each community is infected. My pc runs the *evolutionSIR* function in 1.1 s ± 48 ms, and the total time to run the both functions is 1.16 s ± 48 ms. For my study I need to run O(1E6) the two functions, and it takes a long time on my personal computer. Reading the documentation, I noticed that *iterate_sync* has the *niter* parameter and I tried it like this: v0 = np.random.choice(G.get_vertices(), 1) state = SIRState(G, beta=ep_beta, gamma=gamma, v0=v0, constant_beta=True) state.iterate_sync(niter=count) Doing this, it results to be almost 2.85 times faster (385 ms ± 39.3 ms) than the *evolutionSIR* I wrote before but the problem is that I can't have the states in each evolution step. Is there a way to get the history of the diffusion using *iterate_sync*(niter=count)? Or is there a way to optimize the evolutionSIR function? Greetings -- Sent from: https://nabble.skewed.de/ _______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool