View difference between Paste ID: UTcXJff1 and 0hvHE814
SHOW: | | - or go back to the newest paste.
1
def get_ndlib_model(graph, seed_set):
2
    model = ep.IndependentCascadesModel(g)
3
    config = mc.Configuration()
4
    config.add_model_initial_configuration("Infected", seed_set)
5
    for e in graph.edges():
6-
        config.add_edge_configuration("threshold", e, uniform.random(0,1))
6+
        config.add_edge_configuration("threshold", e, random.uniform(0,1))
7
    model.set_initial_status(config)
8
    return model
9
10
g = nx.erdos_renyi_graph(1000, 0.1)
11
S = [] # some seed set
12
for i in range(5):
13
    S.append(int(random.uniform(1, 999)))
14
15
model = get_ndlib_model(g, S)
16
iterations = model.iteration_bunch(len(g.edges))