Graph Theory37 sections · 1633 units
Open in Course

Quiz: Floyd-Warshall DP State

Knowledge check

Check Your Understanding

In Floyd-Warshall, the DP state is dist[k][i][j]: shortest path from ii to jj using only intermediate vertices from {0,1,,k1}\{0, 1, \ldots, k-1\}. Why can you drop the kk dimension and use just dist[i][j]?

  1. A.The kk dimension is always equal to ii
  2. B.When computing layer kk, you only read from layer k1k-1, and in-place updates do not cause errors
  3. C.Removing the kk dimension makes the algorithm faster
  4. D.The kk dimension only affects the diagonal entries
Start the roadmap to answer the quizzes and solve the challenges