why in Dijkstra’s algorithm do we need to use a min heap. when we will visit all of the vertices anyway… why do we need to pop off the smallest vertex from the heap and check it? Why cant we just pop off the first one. at 0 index? Arent all the vertices in the heap the minimum distances? So why would we need to find the minimum of those? We will check them all anyway.
When I run it without heappop and just using pop(0) it still works the same.
Also what does it mean when run time depends on vertices and edges?