in this Java desktop project I have created Palestine Map. I have implemented the classic Dijkstra’s shortest path algorithm and optimize it for maps. Made it find route information between two cities in Palestine. User may choose the city through mouse or List. The path would appear on the map. This projects includes 50 cities.
Dijkstra’s algorithm is a classic solution to the shortest path problem on a weighted graph. The basic idea is not difficult to understand. We maintain, for every vertex in the graph, the length of the shortest known path from the source to that vertex, and we maintain these lengths in a priority queue. Initially, we put all the vertices on the queue with an artificially high priority and then assign priority 0.0 to the source. The algorithm proceeds by taking the lowest-priority vertex off the PQ, then checking all the vertices that can be reached from that vertex by one edge to see whether that edge gives a shorter path to the vertex from the source than the shortest previously-known path. If so, it lowers the priority to reflect this new information.
In order to run the project, needs the JavaFx library to be build on the projecet path.
The input files of the program contains as many cities as the user want.
file format: Cities:
Adjacents:
javafx.version=17.0.1,
Java.version=17.0.8
Browse for the inputs file:
Ready to run: (read the file correctly)
Map:
Get the shortest path using mouse (by click):
Get the shortest path using the list: