Trace times = [[1,2,1],[1,3,4],[2,3,2]], n = 3, k = 1.
Init: dist = [inf, 0, inf, inf]. Heap: [(0, 1)].
Pop (0, 1). Neighbors: node (weight ), node (weight ). Update: dist[2] = 1, dist[3] = 4. Heap: [(1, 2), (4, 3)].
Pop (1, 2). Neighbor: node (weight ). 1 + 2 = 3 < 4. Update: dist[3] = 3. Heap: [(3, 3), (4, 3)].
Pop (3, 3). No better paths. All visited. Answer: max(0, 1, 3) = 3.
With a binary heap, each edge is processed once: time. The distance array and heap take space.