18 # ifndef SEARCH_MEMORY_LEAKS_ENABLED
19 # error SEARCH NOT ENABLED
21 # define new DEBUG_NEW
23 static char THIS_FILE[] = __FILE__;
33 class less_dist :
public binary_function<node, node, bool>
65 return (*
dist)[n1] < (*dist)[n2];
120 bool source_found =
false;
121 bool target_found =
false;
124 for (node_it = G.
nodes_begin(); node_it != nodes_end; ++node_it)
143 if ((!source_found) || (!target_found))
150 for(edge_it = G.
edges_begin(); edge_it != edges_end; ++edge_it)
152 if (
weight[*edge_it] < 0.0)
169 for(edge_it = G.
edges_begin(); edge_it != edges_end; ++edge_it)
171 max_dist +=
weight[*edge_it];
187 while ((!source_heap.is_empty()) || (!target_heap.is_empty()))
196 node cur_node = source_heap.top();
202 source_mark[cur_node] =
white;
214 cur_node.adj_edges_end();
215 for (adj_edge_it = cur_node.adj_edges_begin();
216 adj_edge_it != adj_edges_end;
220 if (source_mark[op_node] ==
black)
222 source_mark[op_node] =
grey;
225 source_heap.push(op_node);
232 pred[op_node] = *adj_edge_it;
246 else if (source_mark[op_node] ==
grey)
253 source_heap.changeKey(op_node);
260 pred[op_node] = *adj_edge_it;
289 node cur_node = target_heap.top();
297 if ((source_mark[cur_node] ==
white) &&
309 cur_node.in_edges_end();
310 for (in_edge_it = cur_node.in_edges_begin();
311 in_edge_it != in_edges_end;
320 target_heap.push(op_node);
327 succ[op_node] = *in_edge_it;
330 if ((source_mark[op_node] ==
grey) ||
331 (source_mark[op_node] ==
white))
348 target_heap.changeKey(op_node);
355 succ[op_node] = *in_edge_it;
358 if ((source_mark[op_node] ==
grey) ||
359 (source_mark[op_node] ==
white))
381 cur_node.adj_edges_end();
382 for (adj_edge_it = cur_node.adj_edges_begin();
383 adj_edge_it != adj_edges_end;
392 target_heap.push(op_node);
399 succ[op_node] = *adj_edge_it;
402 if ((source_mark[op_node] ==
grey) ||
403 (source_mark[op_node] ==
white))
420 target_heap.changeKey(op_node);
427 succ[op_node] = *adj_edge_it;
430 if ((source_mark[op_node] ==
grey) ||
431 (source_mark[op_node] ==
white))
566 cur_edge =
pred[cur_node];
567 while (cur_edge !=
edge())
570 cur_node = cur_edge.
opposite(cur_node);
571 cur_edge =
pred[cur_node];
576 cur_edge =
succ[cur_node];
577 while (cur_edge !=
edge())
580 cur_node = cur_edge.
opposite(cur_node);
581 cur_edge =
succ[cur_node];