title: How to find the shortest diagonal path of in a squared grid using Dijkstra's algorithm in Java?
body: <p>I am developing a system using Dijkstra's algorithm to display the shortest path in a squared grid using Java. When the path goes to a diagonal, vertical or horizontal cell near by, the path cost increases by 1. But the path's priority should be given to go through diagonal cells. Only when there is no possible diagonal cell near by, the path can go through a vertical or a horizontal cell. What is the most convenient method to do that?</p>