# HG changeset patch # User Alpar Juttner # Date 1380100556 -7200 # Node ID 15e233f588da4563e273f3dc2d489c8e3410e21a # Parent 688a55e4c87825615d40d0a742db2bfc71233f1d Fix invalid map query in NearestNeighborTsp (#476) diff -r 688a55e4c878 -r 15e233f588da lemon/nearest_neighbor_tsp.h --- a/lemon/nearest_neighbor_tsp.h Sun Aug 11 22:30:44 2013 +0200 +++ b/lemon/nearest_neighbor_tsp.h Wed Sep 25 11:15:56 2013 +0200 @@ -115,7 +115,7 @@ if (min_edge1 == INVALID) { for (IncEdgeIt e(_gr, n1); e != INVALID; ++e) { if (!used[_gr.runningNode(e)] && - (_cost[e] < _cost[min_edge1] || min_edge1 == INVALID)) { + (min_edge1 == INVALID || _cost[e] < _cost[min_edge1])) { min_edge1 = e; } } @@ -124,7 +124,7 @@ if (min_edge2 == INVALID) { for (IncEdgeIt e(_gr, n2); e != INVALID; ++e) { if (!used[_gr.runningNode(e)] && - (_cost[e] < _cost[min_edge2] || min_edge2 == INVALID)) { + (min_edge2 == INVALID||_cost[e] < _cost[min_edge2])) { min_edge2 = e; } }