/** * Removes the edge with specified index. */ private void remove(int i) { // Knuth, v. 3, 527, Algorithm R. --_n; for (;;) { _filled[i] = false; int j = i; int r; do { i = (i-1)&_mask; if (!_filled[i]) return; r = hash(_a[i],_b[i]); } while ((i<=r && r<j) || (r<j && j<i) || (j<i && i<=r)); _a[j] = _a[i]; _b[j] = _b[i]; _c[j] = _c[i]; _nabc[j] = _nabc[i]; _filled[j] = _filled[i]; } }
/** * Returns the index corresponding to the mate of the specified edge, * or, if the mate is not found, the index of an empty slot in the set. */ private int indexOfMate(Node a, Node b) { int i = hash(a,b); while (_filled[i]) { if (a==_b[i] && b==_a[i]) return i; i = (i-1)&_mask; } return i; }