Message from JavaScript discussions

May 2017

— The labels allow early bailout from iteration which you want in dfs. Stack would still be there but the whole thing would be more complicated

Message permanent page


So by letting it iterate fully like bfs, then traverse like dfs, the code becomes less complex and control flow a lot more readable, while effectively implementing iddfs as a side effect. I had to google the algorithm after I coded it since I didnt know what I made

— Hah

— Awesome

— Kek, labels in the github repo, but never used

— You really need a stack AND some sort of way to label each node as discovered or undiscovered for any sort of tree search?

Message permanent page

— I kept them for style

— Well, the map does this functionally

— Marking objects is not an option

— Would create an impure function with any number of side effects

— I did explore marking fully, though, it just isn't feasable

— The efficiency tanks drastically when you then need to unmark objects