Question: Write a program in python and explain each step that uses Dijkstra's Algorithm to determine the distance anda shortest path from a Base Node to
Write a program in python and explain each step that uses Dijkstra's Algorithm to determine the distance anda shortest path from a "Base Node" to every other node in a given weighted (undirected) graph G. A data file is to contain a list of Cities (think of the City names as labels on the nodes of the graph) and the upper-right triangular portion of a modified adjacency matrix. (In this adjacency matrix, if there is a direct connection between city i and city j, the ij entry will contain the "distance" between these two cities; otherwise, the ij entry will be zero.) The City names will be shortened to four (4) letters or less. The user should be prompted to enter the name of the data file and the name (label) for the Base Node, which may be any node in the graph. All distances will be measured, and all shortest paths will begin at this Base Node. The output should consist of: 1) the complete adjacency matrix for the graph 2) for each node (except the Base Node): a) the distance from the Base Node to the current node b) a shortest path from the Base Node to the current node This output should go to the screen. It should be in a neat, readable form.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
