// can change while the search. This is the reason for this separate
// search. Now we construct the path.
// The following tree contains only the y nodes!
// The corresponding x node can simply be retrieved from the matching.
SimpleTree augmentatingTree = new SimpleTree();
Set<Integer> yNeighbors = eqSubGraph.getX(u);
augmentatingTree.setRoots(yNeighbors);
int tmpX;
// TODO do we need setS or setT here?
while (!yNeighbors.contains(y)) {
for (int tmpY : yNeighbors) {
if (matching.getY(tmpY).size() > 0) {
tmpX = matching.getY(tmpY).iterator().next();
augmentatingTree.addBranches(tmpY, eqSubGraph.getX(tmpX));
}
}
augmentatingTree.higher();
yNeighbors = augmentatingTree.getNeighbors();
}
// ... and swap the matching along the this path
// => extended matching (one more edge).
boolean ret;
int currentX, currentY;
int lastY = y;
Iterator<Integer> augmentingIter = augmentatingTree.getToRootIterator(y);
while (augmentingIter.hasNext()) {
currentY = augmentingIter.next();
Set<Integer> matchedX = matching.getY(currentY);
assert matchedX.size() == 1;