Блог пользователя Mahmoud-Hossam

Автор Mahmoud-Hossam, история, 11 часов назад, По-английски

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.

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
8 часов назад, скрыть # |
Rev. 7  
Проголосовать: нравится 0 Проголосовать: не нравится

The way you worded the statement is a little bit ambiguous imo, which I initially misinterpreted. I am now interpreting your statement as "for every point (x,y), find the closest source point." This is well-known; see here