-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_reachable.py
40 lines (36 loc) · 1.15 KB
/
plot_reachable.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
40
import matplotlib.pyplot as plt
from load_higgs import DataFiles
def plot_expected_spread():
DF = DataFiles()
with open(DF.out_plot, "r") as f:
lines = f.readlines()
indeg, outdeg, infl, random, celf = [l.split(" ") for l in lines]
plt.plot(indeg, label="In degree")
plt.plot(outdeg, label="Out degree")
plt.plot(infl, label="Influence")
plt.plot(random, label="Random")
plt.plot(celf, label="CELF")
plt.xlabel("#seeds (k)")
plt.ylabel("Expected spread")
plt.legend()
plt.show()
def plot_reachable():
with open("out2", "r") as f:
lines = f.read()
values = {}
for line in lines.split("\n"):
if len(line.split(" ")) == 2:
amt = int(line.split(" ")[0])
if amt not in values.keys():
values[amt] = 0
values[amt] += 1
else:
print(line)
x, y = [], []
for key in values.keys():
x.append(key)
y.append(values[key])
plt.scatter(x, y)
plt.show()
if __name__ == "__main__":
plot_expected_spread()