IST238: Algorithms. Project #4.
This project is dedicated to implementation of the Dijkstra's algorithm for solving
the Shortest Path problem. You need to write a function that takes an adjacent matrix as an input argument and computes the
shortest paths from the specified vertex (also given as an argument) to all other vertices of the graph. This function should
print the shortest paths as well as their weights. For example, having the following input:
disjkstra_shortest_path(W, N, start_point);
where
| W = |
| 0 | 10 | ∞ | | 5 |
| ∞ | 0 | 3 | ∞ | 2 |
| ∞ | ∞ | 0 | 0 | ∞ |
| 7 | ∞ | 6 | 0 | ∞ |
| ∞ | 3 | 9 | 2 | 0 |
|
, N = 5
and start_point = 0
|
the function should print:
0 -> 0 : 0 - 0, price 0
0 -> 1 : 0 - 4 - 1, price 8
0 -> 2 : 0 - 4 - 1 - 2, price 9
0 -> 3 : 0 - 4 - 3, price 7
0 -> 4 : 0 - 4, price 5