COIN-OR::LEMON - Graph Library

Changeset 2519:a7376f7ed899 in lemon-0.x for lemon/dynamic_tree.h


Ignore:
Timestamp:
11/21/07 14:35:10 (16 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3395
Message:

Changed queue implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dynamic_tree.h

    r2514 r2519  
    144144    /// \brief Add \e x value to the cost of every node on the path from
    145145    /// \e item to findRoot(item).
    146     void addCost(const Item &item, Value x){
     146    void addCost(const Item &item, Value x) {
    147147      addPathCost(expose(_iim[item]), x);
    148148    }
     
    201201    }
    202202
    203     int findPath(int v){
     203    int findPath(int v) {
    204204      splay(v);
    205205      return v;
    206206    }
    207207   
    208     int findPathCost(int p, Value &d){
     208    int findPathCost(int p, Value &d) {
    209209      while ((_data[p].right != -1 &&
    210210              !_tolerance.less(0, _data[_data[p].right].dmin)) ||
     
    214214          p = _data[p].right;
    215215        } else if (_data[p].left != -1 &&
    216                    !_tolerance.less(0, _data[_data[p].left].dmin)){
     216                   !_tolerance.less(0, _data[_data[p].left].dmin)) {
    217217          p = _data[p].left;
    218218        }
     
    231231    }
    232232   
    233     void addPathCost(int p, Value x){
     233    void addPathCost(int p, Value x) {
    234234      if (!_tolerance.less(x, _max_value)) {
    235         _data[p].dmin = x;_data[p].dcost = x;
     235        _data[p].dmin = x;
     236        _data[p].dcost = x;
    236237      } else if (!_tolerance.less(-x, _max_value)) {
    237238        _data[p].dmin = 0;
     
    364365      Value aa = _data[a].dcost;
    365366      if (_tolerance.less(aa, _max_value)) {
    366         aa+= min;
     367        aa += min;
    367368      }
    368369
     
    372373      Value bb = _data[b].dcost;
    373374      if (_tolerance.less(bb, _max_value)) {
    374         bb+= ab;
     375        bb += ab;
    375376      }
    376377
     
    381382        cc = _data[c].dmin;
    382383        if (_tolerance.less(cc, _max_value)) {
    383           cc+=min;
     384          cc += min;
    384385        }
    385386      }
     
    687688    }
    688689
    689     int findPath(int v){
     690    int findPath(int v) {
    690691      splay(v);
    691692      return v;
    692693    }
    693694   
    694     int findPathCost(int p, Value &d){
     695    int findPathCost(int p, Value &d) {
    695696      while ((_data[p].right != -1 &&
    696697              !_tolerance.less(0, _data[_data[p].right].dmin)) ||
     
    709710    }
    710711
    711     int findTail(int p){
     712    int findTail(int p) {
    712713      while (_data[p].right != -1) {
    713714        p = _data[p].right;
     
    717718    }
    718719   
    719     void addPathCost(int p, Value x){
     720    void addPathCost(int p, Value x) {
    720721      if (!_tolerance.less(x, _max_value)) {
    721722        _data[p].dmin = x;_data[p].dcost = x;
     
    756757        _data[p].dmin -= min;
    757758      }
    758       if (q!=-1){
     759      if (q != -1){
    759760        _data[q].parent = v;
    760761        if (_tolerance.less(_data[q].dmin,_max_value)) {
     
    764765      _data[v].left = p;
    765766      _data[v].right = q;
    766       if (_tolerance.less(min,_max_value)) {
     767      if (_tolerance.less(min, _max_value)) {
    767768        _data[v].dcost = _data[v].dmin - min;
    768769      }
Note: See TracChangeset for help on using the changeset viewer.