Skip to main content
added 26 characters in body
Source Link
xskxzr
  • 7.6k
  • 5
  • 23
  • 47

Relax every edge of 𝐺$𝐺$ exactly once, if any distance values change, then the shortest path tree given is wrong, if all stay the same then it is correct.

Referring to this statement: As in Bellman-Ford, we run the algorithm |V|-1$|V|-1$ times to compute the single-source shortest path. After this, we run the same algorithm once to check whether any relaxation happened in the graph. If there was any relaxation that means there is a negative weight cycle, and we return False. That's not exactly the case here, however you get the idea! If the algorithm given by the professor was right, then there shouldn't have any room for relaxation because relaxation means that the current shortest path delta(s,v)$\mathrm{delta}(s,v)$ is not the shortest (d(s,v) > delta(s,u) + w(u,v)$d(s,v) > \mathrm{delta}(s,u) + w(u,v)$). Hence, the algorithm was wrong.

Relax every edge of 𝐺 exactly once, if any distance values change, then the shortest path tree given is wrong, if all stay the same then it is correct.

Referring to this statement: As in Bellman-Ford, we run the algorithm |V|-1 times to compute the single-source shortest path. After this, we run the same algorithm once to check whether any relaxation happened in the graph. If there was any relaxation that means there is a negative weight cycle, and we return False. That's not exactly the case here, however you get the idea! If the algorithm given by the professor was right, then there shouldn't have any room for relaxation because relaxation means that the current shortest path delta(s,v) is not the shortest (d(s,v) > delta(s,u) + w(u,v)). Hence, the algorithm was wrong.

Relax every edge of $𝐺$ exactly once, if any distance values change, then the shortest path tree given is wrong, if all stay the same then it is correct.

Referring to this statement: As in Bellman-Ford, we run the algorithm $|V|-1$ times to compute the single-source shortest path. After this, we run the same algorithm once to check whether any relaxation happened in the graph. If there was any relaxation that means there is a negative weight cycle, and we return False. That's not exactly the case here, however you get the idea! If the algorithm given by the professor was right, then there shouldn't have any room for relaxation because relaxation means that the current shortest path $\mathrm{delta}(s,v)$ is not the shortest ($d(s,v) > \mathrm{delta}(s,u) + w(u,v)$). Hence, the algorithm was wrong.

Source Link

Relax every edge of 𝐺 exactly once, if any distance values change, then the shortest path tree given is wrong, if all stay the same then it is correct.

Referring to this statement: As in Bellman-Ford, we run the algorithm |V|-1 times to compute the single-source shortest path. After this, we run the same algorithm once to check whether any relaxation happened in the graph. If there was any relaxation that means there is a negative weight cycle, and we return False. That's not exactly the case here, however you get the idea! If the algorithm given by the professor was right, then there shouldn't have any room for relaxation because relaxation means that the current shortest path delta(s,v) is not the shortest (d(s,v) > delta(s,u) + w(u,v)). Hence, the algorithm was wrong.