dijkstra's algorithm using a minimum heap