Amazon Interview Question

OOP design DSA question regarding graphs (Dijkstra),