59 lines
1.4 KiB
Python
59 lines
1.4 KiB
Python
|
|
#Графики
|
||
|
|
import csv
|
||
|
|
import matplotlib.pyplot as plt
|
||
|
|
|
||
|
|
data = []
|
||
|
|
|
||
|
|
with open('results.csv', 'r') as f:
|
||
|
|
reader = csv.reader(f)
|
||
|
|
for row in reader:
|
||
|
|
data.append(row)
|
||
|
|
|
||
|
|
print(data)
|
||
|
|
|
||
|
|
labs = ['10x10','50x50','100x100','empty','no exit']
|
||
|
|
algorythms = ['BFS','DFS','Astar']
|
||
|
|
valuetypes = ['timeMs','cellsVisited','passLength']
|
||
|
|
|
||
|
|
for lab in labs:
|
||
|
|
|
||
|
|
for vtp in range(len(valuetypes)):
|
||
|
|
|
||
|
|
X = algorythms
|
||
|
|
Y = [0.,0.,0.]
|
||
|
|
|
||
|
|
for row in data:
|
||
|
|
if row[0] == lab:
|
||
|
|
alg = row[1]
|
||
|
|
if alg == X[0]:
|
||
|
|
Y[0] = row[2+vtp]
|
||
|
|
elif alg == X[1]:
|
||
|
|
Y[1] = row[2+vtp]
|
||
|
|
elif alg == X[2]:
|
||
|
|
Y[2] = row[2+vtp]
|
||
|
|
|
||
|
|
plt.bar(X,Y)
|
||
|
|
plt.title(lab + valuetypes[vtp])
|
||
|
|
plt.ylabel(valuetypes[vtp])
|
||
|
|
plt.show()
|
||
|
|
|
||
|
|
# for dt in types:
|
||
|
|
|
||
|
|
# for at in algorythms:
|
||
|
|
|
||
|
|
# X = operations
|
||
|
|
# Y = [0.,0.,0.]
|
||
|
|
|
||
|
|
# for row in data:
|
||
|
|
# if row[1] == dt and row[0] == at:
|
||
|
|
# if row[2] == X[0]:
|
||
|
|
# Y[0] = float(row[3])
|
||
|
|
# elif row[2] == X[1]:
|
||
|
|
# Y[1] = float(row[3])
|
||
|
|
# elif row[2] == X[2]:
|
||
|
|
# Y[2] = float(row[3])
|
||
|
|
|
||
|
|
# plt.bar(X,Y,color='g')
|
||
|
|
# plt.title(dt + at)
|
||
|
|
# plt.ylabel('Время')
|
||
|
|
# plt.show()
|