TripTrekker is a Java-based application that helps users find the shortest path between two cities. It uses a graph-based approach to represent the road network and Dijkstra's algorithm to find the shortest path. The application has a command-line interface that allows users to input their starting and destination cities and get the shortest path along with the total distance.
In a world where time is of the essence, finding the most efficient route between two points is crucial. TripTrekker was developed to solve this very problem. It provides a simple and efficient way to find the shortest path between two cities, saving users time and fuel. The project also serves as a practical application of graph theory and Dijkstra's algorithm, making it a valuable learning tool for students and developers.
To run the TripTrekker application, you need to have make and java installed on your system. Follow these steps:
- Open a terminal or command prompt.
- Navigate to the project directory.
- Run the following command:
make runThis command will compile all the necessary Java files, run the application, and then clean up the compiled class files.
The TripTrekker project is thoroughly tested to ensure reliability and correctness. The testing suite covers various components of the application, including the data handling, algorithm implementation, backend logic, and frontend interface. The tests are divided into the following categories:
DataWranglerTestsAlgorithmEngineerTestsBackendDeveloperTestsFrontendTests
These tests are written using the JUnit 5 framework.
To run the tests for the TripTrekker application, you need to have make and java installed on your system. Follow these steps:
- Open a terminal or command prompt.
- Navigate to the project directory.
- Run the following command:
make runTestsThis command will compile all the necessary Java files, run the tests, and then clean up the compiled class files.
TripTrekker works by modeling the road network as a graph.
- Graph Representation: The application uses a graph data structure where each city is a vertex and each road is a weighted edge. The weight of an edge represents the distance of the road between two cities.
- Dijkstra's Algorithm: To find the shortest path, TripTrekker implements Dijkstra's algorithm. This algorithm systematically explores the graph to find the shortest path from a starting city to all other cities, ultimately identifying the most efficient route to the desired destination.
The application uses a CSV file (roadtrip.csv) to store the road network data. Each row in the CSV file represents a road and has the following format:
origin,destination,distance
origin: The starting city of the road.destination: The ending city of the road.distance: The length of the road in meters.
Here is an example from the roadtrip.csv file:
"Taliesin, County Road C, Spring Green, Wisconsin","Glacier National Park, West Glacier, MT",2218019This line represents a road from "Taliesin, County Road C, Spring Green, Wisconsin" to "Glacier National Park, West Glacier, MT" with a distance of 2,218,019 meters.
TripTrekker is an important project for several reasons:
- Practical Application: It demonstrates the practical application of graph theory and algorithms in solving real-world problems.
- Efficiency: It provides an efficient solution for finding the shortest path, which can be applied to various domains like logistics, transportation, and navigation.
- Educational Value: It serves as an excellent educational tool for understanding graph data structures, Dijkstra's algorithm, and software development best practices.
- Extensibility: The project is designed to be extensible, allowing for the addition of new features like real-time traffic updates, alternative route suggestions, and more.
TripTrekker has the potential for many future enhancements, including:
- Real-time Traffic Updates: Integrating with a real-time traffic data provider to account for current road conditions.
- Alternative Route Suggestions: Providing users with multiple route options, such as the most scenic or the one with the fewest tolls.
- Graphical User Interface (GUI): Developing a GUI to provide a more interactive and user-friendly experience.
- Integration with Mapping Services: Integrating with services like Google Maps or OpenStreetMap to visualize the routes.
- Support for Different Modes of Transportation: Expanding the application to support other modes of transportation like walking, cycling, or public transit.