Bug fix
authordeba
Fri, 02 Mar 2007 17:56:22 +0000
changeset 2385096d83158d41
parent 2384 805c5a2a36dd
child 2386 81b47fc5c444
Bug fix
Setting _pred in init()
lemon/min_cost_arborescence.h
     1.1 --- a/lemon/min_cost_arborescence.h	Thu Mar 01 17:14:24 2007 +0000
     1.2 +++ b/lemon/min_cost_arborescence.h	Fri Mar 02 17:56:22 2007 +0000
     1.3 @@ -398,7 +398,7 @@
     1.4      /// equal to the arborescence value.
     1.5      Value dualValue() const {
     1.6        Value sum = 0;
     1.7 -      for (int i = 0; i < (int)_dual_variables.size(); ++i) {
     1.8 +      for (int i = 0; i < int(_dual_variables.size()); ++i) {
     1.9          sum += _dual_variables[i].value;
    1.10        }
    1.11        return sum;
    1.12 @@ -459,13 +459,13 @@
    1.13        }
    1.14  
    1.15        bool operator==(const DualIt& it) const { 
    1.16 -        return (Node)(*this) == (Node)it; 
    1.17 +        return static_cast<Node>(*this) == static_cast<Node>(it); 
    1.18        }
    1.19        bool operator!=(const DualIt& it) const { 
    1.20 -        return (Node)(*this) != (Node)it; 
    1.21 +        return static_cast<Node>(*this) != static_cast<Node>(it); 
    1.22        }
    1.23        bool operator<(const DualIt& it) const { 
    1.24 -        return (Node)(*this) < (Node)it; 
    1.25 +        return static_cast<Node>(*this) < static_cast<Node>(it); 
    1.26        }
    1.27        
    1.28      private:
    1.29 @@ -498,6 +498,7 @@
    1.30          (*_cost_edges)[it].edge = INVALID;
    1.31          _node_order->set(it, -3); 
    1.32          _heap_cross_ref->set(it, Heap::PRE_HEAP);
    1.33 +        _pred->set(it, INVALID);
    1.34        }
    1.35        for (EdgeIt it(*graph); it != INVALID; ++it) {
    1.36          _arborescence->set(it, false);
    1.37 @@ -682,7 +683,7 @@
    1.38          }      
    1.39        }
    1.40        CostEdge minimum = (*_cost_edges)[nodes[0]]; 
    1.41 -      for (int i = 1; i < (int)nodes.size(); ++i) {
    1.42 +      for (int i = 1; i < int(nodes.size()); ++i) {
    1.43          if ((*_cost_edges)[nodes[i]].value < minimum.value) {
    1.44            minimum = (*_cost_edges)[nodes[i]];
    1.45          }
    1.46 @@ -691,7 +692,7 @@
    1.47        DualVariable var(_dual_node_list.size() - 1, 
    1.48                         _dual_node_list.size(), minimum.value);
    1.49        _dual_variables.push_back(var);
    1.50 -      for (int i = 0; i < (int)nodes.size(); ++i) {
    1.51 +      for (int i = 0; i < int(nodes.size()); ++i) {
    1.52          (*_cost_edges)[nodes[i]].value -= minimum.value;
    1.53          level.edges.push_back((*_cost_edges)[nodes[i]]);
    1.54          (*_cost_edges)[nodes[i]].edge = INVALID;
    1.55 @@ -705,7 +706,7 @@
    1.56        std::vector<Node> nodes;
    1.57        while (!level_stack.empty() && 
    1.58               level_stack.back().node_level >= node_bottom) {
    1.59 -        for (int i = 0; i < (int)level_stack.back().edges.size(); ++i) {
    1.60 +        for (int i = 0; i < int(level_stack.back().edges.size()); ++i) {
    1.61            Edge edge = level_stack.back().edges[i].edge;
    1.62            Node source = graph->source(edge);
    1.63            Value value = level_stack.back().edges[i].value;
    1.64 @@ -724,7 +725,7 @@
    1.65          level_stack.pop_back();
    1.66        }
    1.67        CostEdge minimum = (*_cost_edges)[nodes[0]]; 
    1.68 -      for (int i = 1; i < (int)nodes.size(); ++i) {
    1.69 +      for (int i = 1; i < int(nodes.size()); ++i) {
    1.70          if ((*_cost_edges)[nodes[i]].value < minimum.value) {
    1.71            minimum = (*_cost_edges)[nodes[i]];
    1.72          }
    1.73 @@ -734,7 +735,7 @@
    1.74        _dual_variables.push_back(var);
    1.75        StackLevel level;
    1.76        level.node_level = node_bottom;
    1.77 -      for (int i = 0; i < (int)nodes.size(); ++i) {
    1.78 +      for (int i = 0; i < int(nodes.size()); ++i) {
    1.79          (*_cost_edges)[nodes[i]].value -= minimum.value;
    1.80          level.edges.push_back((*_cost_edges)[nodes[i]]);
    1.81          (*_cost_edges)[nodes[i]].edge = INVALID;