I wrote this code for implementing Dijkstra\'s algorithm to find the max distance from start to end, but it doesn\'t seem to work in some cases, and I am unable to figure ou