Multi source Dijkstra failure on squared Euclidean distance

Правка en1, от Mahmoud-Hossam, 2026-05-02 16:52:46

The problem statement is We are given a 2D grid with multiple source cells. For every cell (x,y), we need to compute the minimum cost to any source, where the cost between two cells is defined as the squared Euclidean distance: cost((x,y),(u,v))=(x−u)^2 + (y−v)^2 I am interested in the reason why dijkstra would fail such task if I start propagation from source nodes, keeping the best_source[x][y] for each visited cell. I understand that the issue is related to the non-linearity of the cost function, but I don’t have a strong intuition for why exactly Dijkstra fails here. What are good ideas or models to easily get why it fails? also, any instances of this problem would be appreciated.

Теги graph, 2d, dijkstra

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Mahmoud-Hossam 2026-05-02 16:52:46 770 Initial revision (published)