Opened 8 years ago

Last modified 8 years ago

#11137 new Bugs

Bug in graph/dijkstra_shortest_paths_no_color_map.hpp

Reported by: hokix@… 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

Change History (1)

in reply to:  description comment:1 by anonymous, 8 years ago

Replying to hokix@…:

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

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.

Note: See TracTickets for help on using tickets.