gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Two bug fixes in DynArcLookUp
0 1 0
default
1 file changed with 3 insertions and 0 deletions:
↑ Collapse diff ↑
Show white space 12 line context
... ...
@@ -1381,12 +1381,13 @@
1381 1381
            }
1382 1382
          }
1383 1383
          splay(s);
1384 1384
        } else {
1385 1385
          _right.set(e, _right[arc]);
1386 1386
          _parent.set(_right[arc], e);
1387
          _parent.set(e, _parent[arc]);
1387 1388

	
1388 1389
          if (_parent[arc] != INVALID) {
1389 1390
            if (_left[_parent[arc]] == arc) {
1390 1391
              _left.set(_parent[arc], e);
1391 1392
            } else {
1392 1393
              _right.set(_parent[arc], e);
... ...
@@ -1511,12 +1512,13 @@
1511 1512
    ///\param t The target node
1512 1513
    ///\return An arc from \c s to \c t if there exists,
1513 1514
    ///\ref INVALID otherwise.
1514 1515
    Arc operator()(Node s, Node t) const
1515 1516
    {
1516 1517
      Arc a = _head[s];
1518
      if (a == INVALID) return INVALID;
1517 1519
      while (true) {
1518 1520
        if (_g.target(a) == t) {
1519 1521
          const_cast<DynArcLookUp&>(*this).splay(a);
1520 1522
          return a;
1521 1523
        } else if (t < _g.target(a)) {
1522 1524
          if (_left[a] == INVALID) {
... ...
@@ -1545,12 +1547,13 @@
1545 1547
    ///\param t The target node
1546 1548
    ///\return An arc from \c s to \c t if there exists, \ref INVALID
1547 1549
    /// otherwise.
1548 1550
    Arc findFirst(Node s, Node t) const
1549 1551
    {
1550 1552
      Arc a = _head[s];
1553
      if (a == INVALID) return INVALID;
1551 1554
      Arc r = INVALID;
1552 1555
      while (true) {
1553 1556
        if (_g.target(a) < t) {
1554 1557
          if (_right[a] == INVALID) {
1555 1558
            const_cast<DynArcLookUp&>(*this).splay(a);
1556 1559
            return r;
0 comments (0 inline)