The path is calculated with a dijkstra algorithm, but no metric is implemented. A metric like costs equal distance would be a simple solution.