Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the program in Java. Thanks Dijkstra's Algorithm Implementation You will implement an algorithm developed by Edsger Dijkstra (1930-2002) to solve the network shortest path
Write the program in Java. Thanks
Dijkstra's Algorithm Implementation You will implement an algorithm developed by Edsger Dijkstra (1930-2002) to solve the network shortest path problem in this lab In addition to the algorithm, there are several other things required to make a program that solves the shortest path problem First, it needs an interface that a user can interact with the program so that the program is "userfriendly Second, you need to create a "digital" network in the computer memory that the program can access. In this lab, you will first create the GUI of the program. Then, you will read a text file that defines the network into the computer memory and finally implement the Dijkstra algorithm. You have three lab sessions to complete this lab The learning goals for you are to learn how to read from/write to text files and to use List and HashTable to implement the Dijkstra algorithm The Dijkstra algorithm, developed a half century ago, finds the shortest path between a vertex and every other vertex on a network graph by constructing and searching a shortest path tree. The algorithm is widely used in modern routing applications that you encounter in everyday life (e.g., on Google map) The algorithm outlined on the wikipedia website has the following steps. Let the node at which we are starting be called the initial node. Let the distance of node Y be the distance from the initial node to Y. Dijkstra's algorithm will assign some initial distance values and will try to improve them step by step Let the node at which we are starting be called the initial node Let the distance of node Y be the distance from the initial node to Y. Dijkstra's algorithm will assign some initial distance values and will try to improve them step by step 1. Assign to every node a distance value: set it to zero for our initial node and to infinity for all other nodes 2. Mark all nodes as unvisited. Set initial node as current 3. For current node, consider all its unvisited neighbors and calculate their tentative distance (from the initial node). For example, if current node (A) has distance of 6, and an edge connecting it with another node (B) is 2, the distance to B through A will be 6+2-8. If this distance is less than the previously recorded distance (infinity in the beginning, zero for the initial node), overwrite the distance Dijkstra's Algorithm Implementation You will implement an algorithm developed by Edsger Dijkstra (1930-2002) to solve the network shortest path problem in this lab In addition to the algorithm, there are several other things required to make a program that solves the shortest path problem First, it needs an interface that a user can interact with the program so that the program is "userfriendly Second, you need to create a "digital" network in the computer memory that the program can access. In this lab, you will first create the GUI of the program. Then, you will read a text file that defines the network into the computer memory and finally implement the Dijkstra algorithm. You have three lab sessions to complete this lab The learning goals for you are to learn how to read from/write to text files and to use List and HashTable to implement the Dijkstra algorithm The Dijkstra algorithm, developed a half century ago, finds the shortest path between a vertex and every other vertex on a network graph by constructing and searching a shortest path tree. The algorithm is widely used in modern routing applications that you encounter in everyday life (e.g., on Google map) The algorithm outlined on the wikipedia website has the following steps. Let the node at which we are starting be called the initial node. Let the distance of node Y be the distance from the initial node to Y. Dijkstra's algorithm will assign some initial distance values and will try to improve them step by step Let the node at which we are starting be called the initial node Let the distance of node Y be the distance from the initial node to Y. Dijkstra's algorithm will assign some initial distance values and will try to improve them step by step 1. Assign to every node a distance value: set it to zero for our initial node and to infinity for all other nodes 2. Mark all nodes as unvisited. Set initial node as current 3. For current node, consider all its unvisited neighbors and calculate their tentative distance (from the initial node). For example, if current node (A) has distance of 6, and an edge connecting it with another node (B) is 2, the distance to B through A will be 6+2-8. If this distance is less than the previously recorded distance (infinity in the beginning, zero for the initial node), overwrite the distanceStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started