A simple Python script for planning optimal road trip routes between cities with basic path optimization.
- Static City Map: Pre-configured network of major US cities
- Dual Optimization Modes:
- Shortest distance (km)
- Fastest time (hours)
- Dijkstra's Algorithm: Efficient pathfinding for optimal routes
- Interactive CLI: User-friendly command-line interface
- Visual Route Display: Clear step-by-step route visualization
python road_trip_planner.py🚗 ROAD TRIP ROUTE PLANNER 🗺️
Available cities:
Atlanta, Boston, Charlotte
Chicago, Cincinnati, Cleveland
...
Enter starting city: New York
Enter destination city: Chicago
Optimization options:
1. Shortest distance
2. Fastest time
Choose option (1/2): 1
============================================================
Route (DISTANCE optimized):
1. New York
↓
2. Philadelphia
↓
3. Pittsburgh
↓
4. Cleveland
↓
5. Detroit
↓
6. Chicago
Total distance: 985.0 km
============================================================
- City Network: The script uses a static graph where cities are nodes and routes are weighted edges
- Dijkstra's Algorithm: Finds the optimal path based on selected criteria (distance or time)
- Priority Queue: Uses heapq for efficient path exploration
- Path Reconstruction: Tracks the complete route from start to destination
- Python 3.6 or higher
- No external dependencies (uses only Python standard library)
- Static map with pre-defined cities (21 major US cities)
- Simplified distance and time calculations
- No real-time traffic data
- Limited to connected cities in the network
- Add more cities and routes
- Support for waypoints/multiple stops
- Export routes to file
- Integration with mapping APIs
- Fuel cost calculations
Created for issue #617 - 100 Lines of Python Code Project
Open source - feel free to modify and enhance!