Different dijkstra algorithm using different key for the priority queue