GET /route {
start_point
end_point
} - returns list os roads and estimates time to arrival.
We can represent map as graph , where nodes - road intersections and edges - roads with metrics (distance, speed limits, traffic data). Lets split graph on grid with layers, where layers represent : 1) local, small roads, 2 larger streets typically within a city, and 3 highways.
nodes table {
node_id,
lon,
lat
}
edges_table {
edge_id,
source_node_id,
target_node_id,
length_m,
speed_limit_kph,
road_class,
is_one_way,
traffic_factor,
last_updated_at
)
edge_profiles_table {
edge_id
car_cost
truck_cost
bike_cost
pedestrian_cost
}
User enters origin and destination.
API Gateway routes request to Routing Service.
Routing Service checks Cache for existing route (origin + destination + time).
If cache hit → return cached path.
If miss:
Response is cached and returned to the user.
Trade offs between Dijkstra and A* algorithms.
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?