-
Notifications
You must be signed in to change notification settings - Fork 7
/
IM_spread.py
40 lines (22 loc) · 910 Bytes
/
IM_spread.py
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
30
31
32
33
34
35
36
37
38
39
from utils import *
def IM_spread(dataset_name,file_name,seed_size):
data_path = './data/%s.txt' %(dataset_name)
# obtain the set of seed nodes of PrivGraph
S = find_seed(file_name,seed_size=seed_size)
# calculate the influence spread
influence_spread = cal_spread(data_path,S_all=S,seed_size=seed_size)
return influence_spread
if __name__ == '__main__':
epsilon = 1.5
seed_size = 20
# set the dataset
# dataset_name = 'Enron'
# dataset_name = 'CA-HepPh'
# dataset_name = 'Facebook'
dataset_name = 'Chamelon'
root_path = './result/'
# import the txt file
file_name = root_path + 'PrivGraph_%s_%.1f.txt' %(dataset_name,epsilon)
print('dataset:%s,epsilon:%.1f,seed_size:%d'%(dataset_name,epsilon,seed_size))
influence_spread = IM_spread(dataset_name,file_name,seed_size)
print('Influence Spread:',influence_spread)