Opened 8 years ago
Last modified 8 years ago
#11137 new Bugs
Bug in graph/dijkstra_shortest_paths_no_color_map.hpp
Reported by: | Owned by: | Jeremiah Willcock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | graph |
Version: | Boost 1.57.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hi,
I'm a new user to Boost Graph Library and I'm just start to figure out how to use it. So I apologize if I'm wrong.
While testing dijkstra algorithm, I found a possible bug in graph/dijkstra_shortest_paths_no_color_map.hpp.
In function dijkstra_shortest_paths_no_color_map_no_init, the code does not initialize distance_map[start_vertex] to 0 before push it into vertex_queue, as the document says here http://www.boost.org/doc/libs/1_57_0/libs/graph/doc/dijkstra_shortest_paths_no_color_map.html
So this will always return at the start vertex if the distance_map is initialized to infinity:
if (!distance_compare(min_vertex_distance, distance_infinity)) { // This is the minimum vertex, so all other vertices are unreachable return; }
Hui Xiao
Replying to hokix@…:
I'm sorry, I didn't notice that the initialization is in function dijkstra_shortest_paths_no_color_map and I have to init distance_map[start_vertex] to 0 myself.