Maps are very good at optimizing routes for cars. They use traffic data, congestion, road types, and real time conditions.
But with walking it's different.
A person usually walks at a constant speed. There are no traffic jams for walking. The only real thing that stops a person is traffic lights.
Because of the traffic lights, the shortest route may not always be the fastest one.
So the idea is simple: If a system knows your average walking speed, where traffic lights are, and how long red and green lights last, it can choose a path that reduces your waiting time.
This project assumes that all the required data is known, and implements the logic for time-based walking route optimization using traffic light cycles and constant human walking speed.
It uses Dijkstra’s algorithm with a wait time penalty at red lights to find the fastest path, and Breadth-first Search to simulate all paths for visualization.
We also assume that:
- person walks at a constant average speed
- traffic lights have fixed green and red cycles (no sensors or pedestrian buttons and etc.)
- route is flat (no stairs, slopes and etc.)
- person is a Law Abiding Citizen and follows traffic rules
- person does not start crossing the road if they cannot reach the other side before the light turns red (no crossing at the orange light)
- map graph is a Directed Acyclic Graph (for the sake of simplicity)
git clone https://github.com/Otina12/google-maps-optimized-walking
cd google-maps-optimized-walkingWindows PowerShell:
python -m venv venv
.\venv\Scripts\Activate.ps1macOS or Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtFrom the project root:
cd src/demo
python main.pyEdit input/points.txt:
point,x,y
A,1420,1290
B,1440,1240
Edit input/edges.txt.
source,target,green_time,red_time,cycle_offset
A,B,20,60,0
A,E,0,0,0
Important: Edges should form a Directed Acyclic Graph.
Update images at these paths:
After running, the simulator generates:
- an mp4 video
- an animated webp
This project is a simplified model and does not fully represent real-world walking conditions.
Things not considered:
- traffic lights are often adaptive and not fixed cycle
- pedestrian phases are different from car green phases
- push button crossings and sensor based lights
- variable walking speed due to slope, stairs, surface, weather, or crowd density
- sidewalk quality, safety, lighting, and accessibility
- real world map inaccuracies and construction
Possible improvements:
- use probabilistic wait times instead of fixed waits
- add uncertainty and expected time instead of single time values
- add user preferences such as safety, accessibility, or fewer crossings
The example input uses a real map route in Tbilisi, Georgia from Point A to Point B. Traffic light positions, timings and cycles are close to actual values.
This is only a concept project. It shows that walking navigation can easily be improved.
