dijkstra's shortest path algorithm (not working)