lemon/core.h
changeset 628 aa1804409f29
parent 606 c5fd2d996909
child 664 4137ef9aacc6
     1.1 --- a/lemon/core.h	Tue Apr 14 10:34:12 2009 +0200
     1.2 +++ b/lemon/core.h	Tue Apr 14 10:35:38 2009 +0200
     1.3 @@ -1315,27 +1315,27 @@
     1.4  
     1.5      virtual void clear() {
     1.6        for(NodeIt n(_g);n!=INVALID;++n) {
     1.7 -        _head.set(n, INVALID);
     1.8 +        _head[n] = INVALID;
     1.9        }
    1.10      }
    1.11  
    1.12      void insert(Arc arc) {
    1.13        Node s = _g.source(arc);
    1.14        Node t = _g.target(arc);
    1.15 -      _left.set(arc, INVALID);
    1.16 -      _right.set(arc, INVALID);
    1.17 +      _left[arc] = INVALID;
    1.18 +      _right[arc] = INVALID;
    1.19  
    1.20        Arc e = _head[s];
    1.21        if (e == INVALID) {
    1.22 -        _head.set(s, arc);
    1.23 -        _parent.set(arc, INVALID);
    1.24 +        _head[s] = arc;
    1.25 +        _parent[arc] = INVALID;
    1.26          return;
    1.27        }
    1.28        while (true) {
    1.29          if (t < _g.target(e)) {
    1.30            if (_left[e] == INVALID) {
    1.31 -            _left.set(e, arc);
    1.32 -            _parent.set(arc, e);
    1.33 +            _left[e] = arc;
    1.34 +            _parent[arc] = e;
    1.35              splay(arc);
    1.36              return;
    1.37            } else {
    1.38 @@ -1343,8 +1343,8 @@
    1.39            }
    1.40          } else {
    1.41            if (_right[e] == INVALID) {
    1.42 -            _right.set(e, arc);
    1.43 -            _parent.set(arc, e);
    1.44 +            _right[e] = arc;
    1.45 +            _parent[arc] = e;
    1.46              splay(arc);
    1.47              return;
    1.48            } else {
    1.49 @@ -1357,27 +1357,27 @@
    1.50      void remove(Arc arc) {
    1.51        if (_left[arc] == INVALID) {
    1.52          if (_right[arc] != INVALID) {
    1.53 -          _parent.set(_right[arc], _parent[arc]);
    1.54 +          _parent[_right[arc]] = _parent[arc];
    1.55          }
    1.56          if (_parent[arc] != INVALID) {
    1.57            if (_left[_parent[arc]] == arc) {
    1.58 -            _left.set(_parent[arc], _right[arc]);
    1.59 +            _left[_parent[arc]] = _right[arc];
    1.60            } else {
    1.61 -            _right.set(_parent[arc], _right[arc]);
    1.62 +            _right[_parent[arc]] = _right[arc];
    1.63            }
    1.64          } else {
    1.65 -          _head.set(_g.source(arc), _right[arc]);
    1.66 +          _head[_g.source(arc)] = _right[arc];
    1.67          }
    1.68        } else if (_right[arc] == INVALID) {
    1.69 -        _parent.set(_left[arc], _parent[arc]);
    1.70 +        _parent[_left[arc]] = _parent[arc];
    1.71          if (_parent[arc] != INVALID) {
    1.72            if (_left[_parent[arc]] == arc) {
    1.73 -            _left.set(_parent[arc], _left[arc]);
    1.74 +            _left[_parent[arc]] = _left[arc];
    1.75            } else {
    1.76 -            _right.set(_parent[arc], _left[arc]);
    1.77 +            _right[_parent[arc]] = _left[arc];
    1.78            }
    1.79          } else {
    1.80 -          _head.set(_g.source(arc), _left[arc]);
    1.81 +          _head[_g.source(arc)] = _left[arc];
    1.82          }
    1.83        } else {
    1.84          Arc e = _left[arc];
    1.85 @@ -1387,38 +1387,38 @@
    1.86              e = _right[e];
    1.87            }
    1.88            Arc s = _parent[e];
    1.89 -          _right.set(_parent[e], _left[e]);
    1.90 +          _right[_parent[e]] = _left[e];
    1.91            if (_left[e] != INVALID) {
    1.92 -            _parent.set(_left[e], _parent[e]);
    1.93 +            _parent[_left[e]] = _parent[e];
    1.94            }
    1.95  
    1.96 -          _left.set(e, _left[arc]);
    1.97 -          _parent.set(_left[arc], e);
    1.98 -          _right.set(e, _right[arc]);
    1.99 -          _parent.set(_right[arc], e);
   1.100 +          _left[e] = _left[arc];
   1.101 +          _parent[_left[arc]] = e;
   1.102 +          _right[e] = _right[arc];
   1.103 +          _parent[_right[arc]] = e;
   1.104  
   1.105 -          _parent.set(e, _parent[arc]);
   1.106 +          _parent[e] = _parent[arc];
   1.107            if (_parent[arc] != INVALID) {
   1.108              if (_left[_parent[arc]] == arc) {
   1.109 -              _left.set(_parent[arc], e);
   1.110 +              _left[_parent[arc]] = e;
   1.111              } else {
   1.112 -              _right.set(_parent[arc], e);
   1.113 +              _right[_parent[arc]] = e;
   1.114              }
   1.115            }
   1.116            splay(s);
   1.117          } else {
   1.118 -          _right.set(e, _right[arc]);
   1.119 -          _parent.set(_right[arc], e);
   1.120 -          _parent.set(e, _parent[arc]);
   1.121 +          _right[e] = _right[arc];
   1.122 +          _parent[_right[arc]] = e;
   1.123 +          _parent[e] = _parent[arc];
   1.124  
   1.125            if (_parent[arc] != INVALID) {
   1.126              if (_left[_parent[arc]] == arc) {
   1.127 -              _left.set(_parent[arc], e);
   1.128 +              _left[_parent[arc]] = e;
   1.129              } else {
   1.130 -              _right.set(_parent[arc], e);
   1.131 +              _right[_parent[arc]] = e;
   1.132              }
   1.133            } else {
   1.134 -            _head.set(_g.source(arc), e);
   1.135 +            _head[_g.source(arc)] = e;
   1.136            }
   1.137          }
   1.138        }
   1.139 @@ -1430,17 +1430,17 @@
   1.140        Arc me=v[m];
   1.141        if (a < m) {
   1.142          Arc left = refreshRec(v,a,m-1);
   1.143 -        _left.set(me, left);
   1.144 -        _parent.set(left, me);
   1.145 +        _left[me] = left;
   1.146 +        _parent[left] = me;
   1.147        } else {
   1.148 -        _left.set(me, INVALID);
   1.149 +        _left[me] = INVALID;
   1.150        }
   1.151        if (m < b) {
   1.152          Arc right = refreshRec(v,m+1,b);
   1.153 -        _right.set(me, right);
   1.154 -        _parent.set(right, me);
   1.155 +        _right[me] = right;
   1.156 +        _parent[right] = me;
   1.157        } else {
   1.158 -        _right.set(me, INVALID);
   1.159 +        _right[me] = INVALID;
   1.160        }
   1.161        return me;
   1.162      }
   1.163 @@ -1452,46 +1452,46 @@
   1.164          if (!v.empty()) {
   1.165            std::sort(v.begin(),v.end(),ArcLess(_g));
   1.166            Arc head = refreshRec(v,0,v.size()-1);
   1.167 -          _head.set(n, head);
   1.168 -          _parent.set(head, INVALID);
   1.169 +          _head[n] = head;
   1.170 +          _parent[head] = INVALID;
   1.171          }
   1.172 -        else _head.set(n, INVALID);
   1.173 +        else _head[n] = INVALID;
   1.174        }
   1.175      }
   1.176  
   1.177      void zig(Arc v) {
   1.178        Arc w = _parent[v];
   1.179 -      _parent.set(v, _parent[w]);
   1.180 -      _parent.set(w, v);
   1.181 -      _left.set(w, _right[v]);
   1.182 -      _right.set(v, w);
   1.183 +      _parent[v] = _parent[w];
   1.184 +      _parent[w] = v;
   1.185 +      _left[w] = _right[v];
   1.186 +      _right[v] = w;
   1.187        if (_parent[v] != INVALID) {
   1.188          if (_right[_parent[v]] == w) {
   1.189 -          _right.set(_parent[v], v);
   1.190 +          _right[_parent[v]] = v;
   1.191          } else {
   1.192 -          _left.set(_parent[v], v);
   1.193 +          _left[_parent[v]] = v;
   1.194          }
   1.195        }
   1.196        if (_left[w] != INVALID){
   1.197 -        _parent.set(_left[w], w);
   1.198 +        _parent[_left[w]] = w;
   1.199        }
   1.200      }
   1.201  
   1.202      void zag(Arc v) {
   1.203        Arc w = _parent[v];
   1.204 -      _parent.set(v, _parent[w]);
   1.205 -      _parent.set(w, v);
   1.206 -      _right.set(w, _left[v]);
   1.207 -      _left.set(v, w);
   1.208 +      _parent[v] = _parent[w];
   1.209 +      _parent[w] = v;
   1.210 +      _right[w] = _left[v];
   1.211 +      _left[v] = w;
   1.212        if (_parent[v] != INVALID){
   1.213          if (_left[_parent[v]] == w) {
   1.214 -          _left.set(_parent[v], v);
   1.215 +          _left[_parent[v]] = v;
   1.216          } else {
   1.217 -          _right.set(_parent[v], v);
   1.218 +          _right[_parent[v]] = v;
   1.219          }
   1.220        }
   1.221        if (_right[w] != INVALID){
   1.222 -        _parent.set(_right[w], w);
   1.223 +        _parent[_right[w]] = w;
   1.224        }
   1.225      }
   1.226