This is more of a general question. I have a map that maps the name of a city to its node(containing basic info such as country, lat, long, etc.). Each city node has an array of edges pointing to destination nodes. The edge has a time and a cost member. I would like to find the shortest time to travel between two nodes, but I've begun confusing myself about the best way to go about this.
I have created my own min heap class that is based on a vector of city nodes. I am able to create the map add the city nodes from the map to the min heap. I have written the dijkstra's algorithm to find the shortest path and it works for some paths but not all. I believe this is because when I update the weight of a city node for dijkstra's algorithm, the heap is not being sorted correctly.
Once I update the weight of a node, how am I supposed to re-heapify the heap so that the lowest weight is at the top?
Thank you!