Question: Implement Dijkstras Algorithm for finding Single Source Shortest Paths in C++ and JAVA, assume that the weight is positive. Use Adjacency List Representation to store

Implement Dijkstras Algorithm for finding Single Source Shortest Paths in C++ and JAVA, assume that the weight is positive. Use Adjacency List Representation to store and process the graph. The algorithm used in the program should be of complexity ((v + e) ln v) where v is vertices and e is edges. The program should read from the txt file. The text file contains data the in following order.

n

e

x1 y1 w1

x2 y2 w2

where x1 and y1 are the nodes and w1 is the weight of the edge between them. This program is a Single source Dijkstra algorithm. For example, we can assume that the 1st node is always the source node.

Please note that the node names will always be the numbers i.e. 1, 2, 54,132 etc. The user will input the name of the destination node. At the end we have to show 2 things, 1, Shortest distance from the source node to the destination node and 2) the shortest path from 1 to the given destination node.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!