Opened 6 years ago

Last modified 6 years ago

#12701 new Bugs

Numerical error cause invalid input to dijkstra algorithm in min cost max flow code

Reported by: Dmitrii Marin <dmitry.marin@…> Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Line 46 of successive_shortest_path_nonnegative_weights.hpp computes a new weight for Dijkstra algorithm. The weigh is guaranteed to be non-negative in theory. In practice numerical rounding errors may make it a small negative number causing the failure of Dijkstra algorithm.

Do something like this for floating point types: return std::max(value_type(0), get(distance_, source(v, g_)) - get(distance_, target(v, g_)) + get(weight_, v));

Change History (3)

comment:1 by Dmitrii Marin <dmitry.marin@…>, 6 years ago

Version: Boost 1.61.0Boost 1.63.0

comment:2 by Dmitrii Marin <dmitry.marin@…>, 6 years ago

Version: Boost 1.63.0Boost Development Trunk

comment:3 by Kohei Takahashi, 6 years ago

Component: Nonegraph
Owner: set to Jeremiah Willcock
Note: See TracTickets for help on using tickets.