static void ai_gc_scan(S root) { ai_gc_clear(); time "GC Scan" { ai_postTriple(root, "has GC distance", "0"); HashMap distances = lithashmap(root, 0); new LinkedList queue = litLinkedList(root); S word; while ping ((word = queue.poll()) != null) { int d = distances.get(word)+1; for (WebNode node : indexedNodes(word)) for (WebNode n : web_forwardOrBackwardRelated(node)) { S text = ai_shortenForIndex(web_text(n)); Int od = distances.get(text); if (od == null || d < od) { distances.put(text, d); queue.add(text); } } } } print(n(distances, "term") + "were reached in GC scan from " + quote(root) + "; " + l(); }