Understanding the Longest Path Problem and the Bellmanford Act

Asked 1 years ago, Updated 1 years ago, 269 views

We know that the longest route problem for non-negative weighted effective graphs is difficult to NP.However, if you solve the shortest path problem using the Bellmanford method, you will inevitably solve the longest path problem. What is the problem?

algorithm calculated-amount

2022-12-01 14:44

1 Answers

"The ""longest path problem"" that involves NP integrity refers to the problem of finding the longest simple path (simple path, path with no overlapping vertices) in a weighted directed graph."On the other hand, the shortest route problem, such as the Bellman-Ford method, solves the problem of finding the shortest route.Considering that you want a simple road instead of a road, you can see that -1 times the weight of the side is not enough.

Also, if you are thinking about finding the longest path rather than the longest simple path, you can get to the shortest path problem by multiplying the weight by -1.In this case, if the original graph has a regular closure path that can be reached from the starting point, the length can be increased indefinitely, so there is no solution.


2022-12-01 14:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.