# HG changeset patch
# User Alpar Juttner <alpar@cs.elte.hu>
# Date 1380100556 -7200
# Wed Sep 25 11:15:56 2013 +0200
# Node ID 39d27d0b7939d1816629231394350b5023240464
# Parent c08d0f04c1176379ba7e476d321ccc4992840ab9
Fix invalid map query in NearestNeighborTsp (#476)
diff --git a/lemon/nearest_neighbor_tsp.h b/lemon/nearest_neighbor_tsp.h
a
|
b
|
|
115 | 115 | if (min_edge1 == INVALID) { |
116 | 116 | for (IncEdgeIt e(_gr, n1); e != INVALID; ++e) { |
117 | 117 | if (!used[_gr.runningNode(e)] && |
118 | | (_cost[e] < _cost[min_edge1] || min_edge1 == INVALID)) { |
| 118 | (min_edge1 == INVALID || _cost[e] < _cost[min_edge1])) { |
119 | 119 | min_edge1 = e; |
120 | 120 | } |
121 | 121 | } |
… |
… |
|
124 | 124 | if (min_edge2 == INVALID) { |
125 | 125 | for (IncEdgeIt e(_gr, n2); e != INVALID; ++e) { |
126 | 126 | if (!used[_gr.runningNode(e)] && |
127 | | (_cost[e] < _cost[min_edge2] || min_edge2 == INVALID)) { |
| 127 | (min_edge2 == INVALID||_cost[e] < _cost[min_edge2])) { |
128 | 128 | min_edge2 = e; |
129 | 129 | } |
130 | 130 | } |