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
"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.
578 Understanding How to Configure Google API Key
911 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
581 PHP ssh2_scp_send fails to send files as intended
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.