Amazon Interview Question

How to calculate shortest route using graphs