forked from scoutsaachi/poxStartup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
58 lines (49 loc) · 1.35 KB
/
plot.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import matplotlib.pyplot as plt
import pickle
counter = 0
for totalPortSelect in range(6, 20):
for switchPortSelect in range(4, totalPortSelect):
# if (totalPortSelect * switchPortSelect) % 2 != 0:
# continue
# if totalPortSelect == switchPortSelect:
# continue
k = totalPortSelect
r = switchPortSelect
try:
with open('k' + str(k) + 'r' + str(r) + '.pickle', 'rb') as handle:
graph = pickle.load(handle)
except:
continue
kshort = graph[0]
ecmp8 = graph[1]
ecmp64 = graph[2]
def create_bucket_xy(plots) :
x = []
y = []
total = 0
x.append(total)
y.append(0)
for i in range(len(plots)) :
num = plots[i]
if num == 0:
continue
x.append(total)
y.append(i)
total += num
x.append(total)
y.append(i)
return x, y
plt.figure(counter)
x, y = create_bucket_xy(kshort)
plt.plot(x, y, label="k-shortest paths")
x, y = create_bucket_xy(ecmp8)
plt.plot(x, y, label="ecmp8")
x, y = create_bucket_xy(ecmp64)
plt.plot(x, y, label="ecmp64")
plt.xlabel('Rank of Link')
plt.ylabel('# Distinct Paths Link is on')
plt.axis([0, 3000, 0, 18])
plt.grid(True)
plt.legend(loc=2)
plt.show()
counter += 1