SIState using dynamic beta edges

I am trying to spread an infection over a random graph where the beta is an
edge property. I want to implement something that could simulate the
lockdown, this is what I wrote:

import matplotlib.pyplot as plt
from graph_tool.all import *
import numpy as np
import random

# graph parameters
N = 6000 # number of vertices
max_count = 100 # time_stamp
beta = 0.01
time_cut = 10

def deg_sample(k):
    return np.random.poisson(k)

def evolution(G, beta, counts, perc):
    eprop = G.new_edge_property("double")
    eprop.a = beta

    state = SIState(G, beta=eprop, constant_beta=False)

    infected = [state.get_state().fa.sum()]
    time = range(counts)
    for i in time:
        if (i == time_cut) & (perc != 0):
            n = np.array(random.sample(range(len(list(G.edges()))),
int(G.num_edges() * perc/100)))
            eprop.a[n] = 0

    return infected

G = random_graph(N, lambda: deg_sample(5), directed=False)
G = extract_largest_component(G)
graph_draw(G, output='network_layout.pdf')

x = evolution(G, beta, max_count, 100)

plt.ylabel(r"Infectious nodes")
plt.title('infected vs time with all edges cutted at time=%d' % time_cut)

In evolution I change the beta of all the edges of the graph at a given
timestamp, and I would expect that the infection will stop to spread after I
change the edge property map. But it doesn't happen and the infenction
continue to spread in the network.
I want to understand better what's happening in the SIState fuction.

There was a bug in the implementation of 'constant_beta' that prevents
this for working. This has been fixed already in the git version. In the
meantime, you will need to re-create the SISState object after you
modify the transmission probabilities.

(Note also that your code is terribly inefficient, and you generate a
full list of edges at each iteration, only to sample a single one.)

I solved my issue re-creating a new SIState using s parameter to keep
tracking of the previous graph vertices states.
This is how I did it:

def evolution(G, beta, count, perc):

    eprop = G.new_edge_property("double")
    vprop = G.new_vertex_property("int")
    eprop.a = beta

    state = SIState(G, beta=eprop, constant_beta=False)
    infected = [state.get_state().fa.sum()]

    for i in range(count):

        if (i == time_cut) & (perc != 0.):
            n = np.array(random.sample(range(G.num_edges()),
int(G.num_edges() * perc / 100)))
            eprop.a[n] = 0.

            vprop.a = state.get_state().fa

            state = SIState(G, beta=eprop, s=vprop, constant_beta=False)

    return infected

n is an array containing only the edges' indexes edges of which I want to
modify. And using eprop.a[n], I change the properties of the selected edges.
When I reapply the SIState, the s parameter keeps the previous vertices
states stored in vprop.

I don't understand where the code is inefficient, could you tell me where I
am wrong?