tracing BFS: add cycles protection

This commit is contained in:
Gregory.Shrago
2015-05-27 11:12:54 +03:00
parent ff658adf30
commit baf69693d3
@@ -340,6 +340,7 @@ public abstract class TreeTraverser<T> {
public T next() {
T result = queue.remove();
for (T t : children(result)) {
if (paths.containsKey(t)) continue;
queue.add(t);
paths.put(t, result);
}