| import matplotlib.pyplot as plt |
| import numpy as np |
|
|
| |
| plt.style.use('bmh') |
|
|
| |
| |
| |
| |
| def generate_memory_line_graph(): |
| |
| time_hours = np.linspace(0, 72, 100) |
| |
| |
| |
| standard_storage_gb = time_hours * 27 |
| |
| |
| proposed_storage_gb = np.zeros_like(time_hours) |
| |
| plt.figure(figsize=(8, 5)) |
| plt.plot(time_hours, standard_storage_gb, label="Standard Raw Logging (Linear Growth)", |
| color='#e74c3c', linestyle='--', linewidth=2.5) |
| plt.plot(time_hours, proposed_storage_gb, label="Proposed System ($O(1)$ Accumulator)", |
| color='#2ecc71', linewidth=3) |
| |
| plt.fill_between(time_hours, standard_storage_gb, color='#e74c3c', alpha=0.1) |
| |
| plt.xlabel("Time (Hours)", fontweight='bold') |
| plt.ylabel("Cumulative Storage Size (Gigabytes)", fontweight='bold') |
| plt.title("Memory Overhead Over 72-Hour Stress Test", fontsize=14, fontweight='bold', pad=15) |
| plt.legend(loc="upper left") |
| plt.grid(True, linestyle=':', alpha=0.7) |
| |
| plt.tight_layout() |
| plt.savefig("Graph1_Memory_Line_Graph.png", dpi=300) |
| plt.close() |
| print("Generated: Graph1_Memory_Line_Graph.png") |
|
|
|
|
| |
| |
| |
| |
| def generate_network_bar_graph(): |
| methods = ["Standard Batch-Logging\n(Raw Logs)", "Proposed System\n(Cryptographic Witness)"] |
| |
| |
| |
| |
| payload_sizes = [16000, 256] |
| |
| plt.figure(figsize=(7, 5)) |
| bars = plt.bar(methods, payload_sizes, color=['#34495e', '#3498db'], edgecolor='black', width=0.6) |
| |
| plt.yscale('log') |
| plt.ylabel("Payload Size per Epoch (Bytes) - Log Scale", fontweight='bold') |
| plt.title("Network Bandwidth Consumption per Epoch", fontsize=14, fontweight='bold', pad=15) |
| |
| |
| for bar in bars: |
| yval = bar.get_height() |
| plt.text(bar.get_x() + bar.get_width()/2, yval * 1.2, |
| f"{int(yval):,} Bytes", ha='center', va='bottom', fontweight='bold') |
| |
| |
| plt.annotate('98.4% Reduction', |
| xy=(1, 256), xytext=(0.5, 1000), |
| arrowprops=dict(facecolor='red', shrink=0.05, width=2, headwidth=8), |
| fontsize=12, fontweight='bold', color='red', ha='center') |
|
|
| plt.tight_layout() |
| plt.savefig("Graph2_Network_Bar_Graph.png", dpi=300) |
| plt.close() |
| print("Generated: Graph2_Network_Bar_Graph.png") |
|
|
|
|
| |
| |
| |
| |
| def generate_latency_bar_graph(): |
| tasks = ["Dynamic Witness Update\n(Continuous Ingestion)", |
| "Smart Contract\nVerification (Ledger)", |
| "Epoch Witness Computation\n(Asynchronous Trigger)"] |
| |
| |
| times = [10, 30, 45] |
| |
| plt.figure(figsize=(8, 4)) |
| bars = plt.barh(tasks, times, color=['#9b59b6', '#f39c12', '#16a085'], edgecolor='black', height=0.5) |
| |
| plt.xlabel("Processing Time (Milliseconds)", fontweight='bold') |
| plt.title("System Processing Latency Benchmarks", fontsize=14, fontweight='bold', pad=15) |
| |
| |
| for i, bar in enumerate(bars): |
| width = bar.get_width() |
| plt.text(width - 2, bar.get_y() + bar.get_height()/2, |
| f"< {width} ms" if width != 45 else f"~ {width} ms", |
| ha='right', va='center', color='white', fontweight='bold', fontsize=11) |
|
|
| plt.xlim(0, 55) |
| plt.tight_layout() |
| plt.savefig("Graph3_Latency_Bar_Graph.png", dpi=300) |
| plt.close() |
| print("Generated: Graph3_Latency_Bar_Graph.png") |
|
|
| |
| if __name__ == "__main__": |
| generate_memory_line_graph() |
| generate_network_bar_graph() |
| generate_latency_bar_graph() |
| print("All graphs successfully generated!") |
|
|