Graph Theory37 sections · 1633 units
Open in Course

Quiz: Negative Edges in Floyd-Warshall

Knowledge check

Check Your Understanding

Floyd-Warshall handles negative edge weights correctly (unlike Dijkstra). How do you detect a negative cycle after running the algorithm?

  1. A.Check if any dist[i][j] is negative
  2. B.Check if the total sum of all distances is negative
  3. C.Run the algorithm twice and compare results
  4. D.Check if any diagonal entry dist[i][i] is negative
Start the roadmap to answer the quizzes and solve the challenges