-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplotting_optim.py
More file actions
39 lines (30 loc) · 1.11 KB
/
plotting_optim.py
File metadata and controls
39 lines (30 loc) · 1.11 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
import matplotlib.pyplot as plt
numNodes = []
durations0 = []
durations1 = []
with open("opt_test_dur0.txt", "r") as file:
for line in file:
# Splitting each line by comma
data = line.split(", ")
# Extracting numNodes and duration
numNodes.append(int(data[0].split(": ")[1]))
durations0.append(float(data[1].split(": ")[1].split()[0]))
with open("opt_test_dur1.txt", "r") as file:
for line in file:
# Splitting each line by comma
data = line.split(", ")
# Extracting numNodes and duration
# numNodes.append(int(data[0].split(": ")[1]))
durations1.append(float(data[1].split(": ")[1].split()[0]))
plt.rcParams['font.size'] = 22
lw = 6
# Plotting the graph
plt.plot(numNodes, durations0, label="Unoptimized Dynamic Tree", linestyle='solid', linewidth=lw)
plt.plot(numNodes, durations1, label="Optimized Dynamic Tree", linestyle='dotted', linewidth=lw)
plt.legend()
# Adding labels and title
plt.xlabel("Nodes")
plt.ylabel("Time (s)")
plt.title(f"Optimized vs Unoptimized Dynamic Tree Performance Comparison")
# Displaying the plot
plt.show()