# HG changeset patch # User deba # Date 1172858182 0 # Node ID 096d83158d41706ff6f859ada8deeb3430687c61 # Parent 805c5a2a36dd8ce911234170dbca1fac46999382 Bug fix Setting _pred in init() diff -r 805c5a2a36dd -r 096d83158d41 lemon/min_cost_arborescence.h --- a/lemon/min_cost_arborescence.h Thu Mar 01 17:14:24 2007 +0000 +++ b/lemon/min_cost_arborescence.h Fri Mar 02 17:56:22 2007 +0000 @@ -398,7 +398,7 @@ /// equal to the arborescence value. Value dualValue() const { Value sum = 0; - for (int i = 0; i < (int)_dual_variables.size(); ++i) { + for (int i = 0; i < int(_dual_variables.size()); ++i) { sum += _dual_variables[i].value; } return sum; @@ -459,13 +459,13 @@ } bool operator==(const DualIt& it) const { - return (Node)(*this) == (Node)it; + return static_cast(*this) == static_cast(it); } bool operator!=(const DualIt& it) const { - return (Node)(*this) != (Node)it; + return static_cast(*this) != static_cast(it); } bool operator<(const DualIt& it) const { - return (Node)(*this) < (Node)it; + return static_cast(*this) < static_cast(it); } private: @@ -498,6 +498,7 @@ (*_cost_edges)[it].edge = INVALID; _node_order->set(it, -3); _heap_cross_ref->set(it, Heap::PRE_HEAP); + _pred->set(it, INVALID); } for (EdgeIt it(*graph); it != INVALID; ++it) { _arborescence->set(it, false); @@ -682,7 +683,7 @@ } } CostEdge minimum = (*_cost_edges)[nodes[0]]; - for (int i = 1; i < (int)nodes.size(); ++i) { + for (int i = 1; i < int(nodes.size()); ++i) { if ((*_cost_edges)[nodes[i]].value < minimum.value) { minimum = (*_cost_edges)[nodes[i]]; } @@ -691,7 +692,7 @@ DualVariable var(_dual_node_list.size() - 1, _dual_node_list.size(), minimum.value); _dual_variables.push_back(var); - for (int i = 0; i < (int)nodes.size(); ++i) { + for (int i = 0; i < int(nodes.size()); ++i) { (*_cost_edges)[nodes[i]].value -= minimum.value; level.edges.push_back((*_cost_edges)[nodes[i]]); (*_cost_edges)[nodes[i]].edge = INVALID; @@ -705,7 +706,7 @@ std::vector nodes; while (!level_stack.empty() && level_stack.back().node_level >= node_bottom) { - for (int i = 0; i < (int)level_stack.back().edges.size(); ++i) { + for (int i = 0; i < int(level_stack.back().edges.size()); ++i) { Edge edge = level_stack.back().edges[i].edge; Node source = graph->source(edge); Value value = level_stack.back().edges[i].value; @@ -724,7 +725,7 @@ level_stack.pop_back(); } CostEdge minimum = (*_cost_edges)[nodes[0]]; - for (int i = 1; i < (int)nodes.size(); ++i) { + for (int i = 1; i < int(nodes.size()); ++i) { if ((*_cost_edges)[nodes[i]].value < minimum.value) { minimum = (*_cost_edges)[nodes[i]]; } @@ -734,7 +735,7 @@ _dual_variables.push_back(var); StackLevel level; level.node_level = node_bottom; - for (int i = 0; i < (int)nodes.size(); ++i) { + for (int i = 0; i < int(nodes.size()); ++i) { (*_cost_edges)[nodes[i]].value -= minimum.value; level.edges.push_back((*_cost_edges)[nodes[i]]); (*_cost_edges)[nodes[i]].edge = INVALID;