From bed761e2c28315aaccf51058c42eef45b7c9c6a5 Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Wed, 23 May 2001 16:40:46 +0000 Subject: [PATCH] added check for overflow [SVN r10198] --- include/boost/graph/relax.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/boost/graph/relax.hpp b/include/boost/graph/relax.hpp index 91291ae4..9c0e9971 100644 --- a/include/boost/graph/relax.hpp +++ b/include/boost/graph/relax.hpp @@ -55,6 +55,10 @@ namespace boost { D d_u = get(d, u), d_v = get(d, v); W w_e = get(w, e); + // workaround overflow problem, don't relax if d_u is close to inf + if (std::abs(std::numeric_limits::max() - d_u) < std::abs(w_e)) + return false; + if ( compare(combine(d_u, w_e), d_v) ) { put(d, v, combine(d_u, w_e)); put(p, v, u);