boost/boost-1.55.0-graph-dijkstra...

32 lines
1.5 KiB
Diff

Index: /trunk/boost/graph/dijkstra_shortest_paths.hpp
===================================================================
--- /trunk/boost/graph/dijkstra_shortest_paths.hpp (revision 85386)
+++ /trunk/boost/graph/dijkstra_shortest_paths.hpp (revision 85387)
@@ -163,5 +163,5 @@
// Test for negative-weight edges:
//
- // Reasons that simpler comparisons do not work:
+ // Reasons that other comparisons do not work:
//
// m_compare(e_weight, D(0)):
@@ -180,14 +180,13 @@
// and return a distance.
- D source_dist = get(m_distance, source(e, g));
- W e_weight = get(m_weight, e);
+ // W e_weight = get(m_weight, e);
// sd_plus_ew = source_dist + e_weight.
- D sd_plus_ew = m_combine(source_dist, e_weight);
+ // D sd_plus_ew = m_combine(source_dist, e_weight);
// sd_plus_2ew = source_dist + 2 * e_weight.
- D sd_plus_2ew = m_combine(sd_plus_ew, e_weight);
+ // D sd_plus_2ew = m_combine(sd_plus_ew, e_weight);
// The test here is equivalent to e_weight < 0 if m_combine has a
// cancellation law, but always returns false when m_combine is a
- // projection operator or is idempotent.
- if (m_compare(sd_plus_2ew, sd_plus_ew))
+ // projection operator.
+ if (m_compare(m_combine(m_zero, get(m_weight, e)), m_zero))
boost::throw_exception(negative_edge());
// End of test for negative-weight edges.