Exercise #2: Modify getShortestPath(graph, from, to) function so that if there is more than one minimum path from the source node to the destination node, it gives you the one with the minimum number of edges.
Example 1: Input Graph
Adjacency list of the following graph:
From: A To: F or B [A, F)]
Output:
That is, the distance from A to F is 10, both through the following path:
ADF, A > DC > G > F
The correct answer is A-D-F
[A, B]
That is, the distance from A to B is 7, both through the following paths:
AB,
ADCB
The correct answer is A-B