Dijkstra's Algorithm - Implementation using C

Dijkstra's algorithm is used to find the shortest path between two nodes. The algorithm takes on a greedy approach to obtain the solution.

Input:

The first line of input specifies the number of vertices (n) in the weighted graph. Then we have to input the adjacency matrix (n x n matrix). The next input specifies the starting vertex / source vertex (start).

Output:

The output will give the shortest distance from source vertex to each vertex in the weighted graph.

The Code:

Share this:

, , , ,

CONVERSATION

0 comments :

Post a Comment