Boost logo

Boost Users :

Subject: [Boost-users] [BGL] Dijkstra shortest paths with custom compare function and zero weight edges
From: Christian Ofenböck (christian.ofenboeck_at_[hidden])
Date: 2015-05-27 03:16:46


I'm using dijkstra_shortest_paths with a custom compare function like (Weight a, Weight b) { return a<=b; }

As I've also got some zero weight edges within the graph this leads to problems with the test for negative weights in dijkstra_bfs_visitor's examine_edge-function. The test fails on checking zero weight edges and throws a negative_edge-exception (dijkstra_shortest_paths.hpp:190):

if (m_compare(m_combine(m_zero, get(m_weight, e)), m_zero))
evaluates to
if(0<=0)

Any suggestions on how to solve this issue? For now I just got rid of the test, as I just use unsigned weight values, but of course that's not a sound solution.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net