-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
64 lines (49 loc) · 1.86 KB
/
Copy pathscript.py
File metadata and controls
64 lines (49 loc) · 1.86 KB
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
59
60
61
62
63
64
import csv
import pandas as pd
import matplotlib.pyplot as plt
import subprocess
n = 1000
average_path_len = 0
average_shortcuts = 0
with open('data.csv', mode='r', newline='', encoding='utf-8') as file:
reader = csv.reader(file)
header = next(reader)
mu1 = next(reader)
for i in range(10):
row=next(reader)
average_path_len = int(row[7])
average_shortcuts += int(row[8])
labels = ['average_path_len', 'average_shortcuts']
numbers = [average_path_len, average_shortcuts]
plt.bar(labels, numbers, color=['skyblue', 'salmon'])
#plt.title('')
plt.title(mu1[0])
# plt.xlabel('mu = (l * alpha) / n')
plt.ylabel('Values')
plt.savefig("alpha_1")
######################## second mu ############################
average_path_len = 0
average_shortcuts = 0
mu2 = next(reader)
for i in range(10):
row=next(reader)
average_path_len += int(row[7])
average_shortcuts += int(row[8])
labels = ['average_path_len', 'average_shortcuts']
numbers = [average_path_len, average_shortcuts]
plt.bar(labels, numbers, color=['skyblue', 'salmon'])
#plt.title('')
plt.title(mu2[0])
#plt.xlabel('mu = (l * alpha) / n')
plt.ylabel('Values')
plt.savefig("alpha_2")
#df = pd.read_csv('data.csv', skiprows=range(1,2), nrows=100)
#print(df)
#df.plot(x="n", y=["len_path", "shortcut_edges_taken"], kind="bar")
# 3. Display the chart
#plt.ylabel("Units Sold")
#plt.title("Sales Comparison")
#plt.xticks(rotation=0) # Keeps category names horizontal
#plt.show()
#print("average path length: ", average_path_len / 29)
#print("average shortcuts:", average_shortcuts/29)