Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83772 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2013-04-05 14:25:34


Author: jewillco
Date: 2013-04-05 14:25:33 EDT (Fri, 05 Apr 2013)
New Revision: 83772
URL: http://svn.boost.org/trac/boost/changeset/83772

Log:
Changed test for negative edges per #8398; fixes #8398
Text files modified:
   trunk/boost/graph/dijkstra_shortest_paths.hpp | 6 +++++-
   1 files changed, 5 insertions(+), 1 deletions(-)

Modified: trunk/boost/graph/dijkstra_shortest_paths.hpp
==============================================================================
--- trunk/boost/graph/dijkstra_shortest_paths.hpp (original)
+++ trunk/boost/graph/dijkstra_shortest_paths.hpp 2013-04-05 14:25:33 EDT (Fri, 05 Apr 2013)
@@ -159,7 +159,11 @@
       void examine_vertex(Vertex u, Graph& g) { m_vis.examine_vertex(u, g); }
       template <class Edge, class Graph>
       void examine_edge(Edge e, Graph& g) {
- if (m_compare(get(m_weight, e), m_zero))
+ // Comparison needs to be more complicated because distance and weight
+ // types may not be the same; see bug 8398
+ // (https://svn.boost.org/trac/boost/ticket/8398)
+ D source_dist = get(m_distance, source(e, g));
+ if (m_compare(m_combine(source_dist, get(m_weight, e)), source_dist))
             boost::throw_exception(negative_edge());
         m_vis.examine_edge(e, g);
       }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk