blob: 9973dc308eb4b89a201b4e467ec876d6a06c1d0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import numpy as np
import networkx as nx
import cascade_creation
def greedy_prediction(G, cascades):
"""
returns estimated graph
"""
G_hat = cascade_creation.InfluenceGraph(max_proba=None)
G_hat.add_nodes_from(G.nodes())
for node in G.nodes():
unaccounted = cascades
for cascade in cascades:
def test():
"""
unit test
"""
G = cascade_creation.InfluenceGraph(max_proba = .3)
G.erdos_init(n = 100, p = 1)
import time
t0 = time.time()
print len(cascade_creation.icc_cascade(G, p_init=.1))
t1 = time.time()
print t1 - t0
if __name__=="__main__":
test()
|