16 # ifndef SEARCH_MEMORY_LEAKS_ENABLED
17 # error SEARCH NOT ENABLED
19 # define new DEBUG_NEW
21 static char THIS_FILE[] = __FILE__;
51 set<edge>::iterator tree_it;
55 for (tree_it =
tree.begin(); tree_it !=
tree.end(); tree_it++)
56 sum +=
dist[*tree_it];
62 priority_queue <TSP_A_VALUE, vector<TSP_A_VALUE>,
input_comp> node_distances;
65 set<node>::iterator tree_it;
69 unsigned int number_of_nodes;
79 min_dist =
dist[*edge_it];
81 for (; edge_it != edges_end; edge_it++) {
82 if (
dist[*edge_it] < min_dist) {
84 min_dist =
dist[*edge_it];
90 tree_nodes.insert(curr.
source());
91 tree_nodes.insert(curr.
target());
94 for (tree_it = tree_nodes.begin(); tree_it != tree_nodes.end(); tree_it++) {
95 adj_it = (*tree_it).adj_edges_begin();
96 adj_end = (*tree_it).adj_edges_end();
98 for (; adj_it != adj_end; adj_it++) {
107 while(
tree.size() < number_of_nodes - 1) {
108 curr = *((node_distances.top()).second);
110 node_distances.pop();
112 if (tree_nodes.find(curr.
source()) != tree_nodes.end() &&
113 tree_nodes.find(curr.
target()) != tree_nodes.end()) {
118 if (tree_nodes.find(curr.
source()) != tree_nodes.end()) {
124 tree_nodes.insert(new_node);
129 for (; adj_it != adj_end; adj_it++) {