Multiple lines of code added for the shortest path prob