Two bug fixes in DynArcLookUp
authorBalazs Dezso <deba@inf.elte.hu>
Wed, 23 Jul 2008 19:21:20 +0200
changeset 232e39056157d24
parent 231 9ce7a01a95c7
child 233 28239207a8a3
Two bug fixes in DynArcLookUp
lemon/core.h
     1.1 --- a/lemon/core.h	Wed Jul 23 16:51:07 2008 +0100
     1.2 +++ b/lemon/core.h	Wed Jul 23 19:21:20 2008 +0200
     1.3 @@ -1384,6 +1384,7 @@
     1.4          } else {
     1.5            _right.set(e, _right[arc]);
     1.6            _parent.set(_right[arc], e);
     1.7 +          _parent.set(e, _parent[arc]);
     1.8  
     1.9            if (_parent[arc] != INVALID) {
    1.10              if (_left[_parent[arc]] == arc) {
    1.11 @@ -1514,6 +1515,7 @@
    1.12      Arc operator()(Node s, Node t) const
    1.13      {
    1.14        Arc a = _head[s];
    1.15 +      if (a == INVALID) return INVALID;
    1.16        while (true) {
    1.17          if (_g.target(a) == t) {
    1.18            const_cast<DynArcLookUp&>(*this).splay(a);
    1.19 @@ -1548,6 +1550,7 @@
    1.20      Arc findFirst(Node s, Node t) const
    1.21      {
    1.22        Arc a = _head[s];
    1.23 +      if (a == INVALID) return INVALID;
    1.24        Arc r = INVALID;
    1.25        while (true) {
    1.26          if (_g.target(a) < t) {