On 2013-04-09, at 6:09 PM, John Gleeson wrote: > It > can be solved with breadth-first search (BFS). After studying your code a bit longer, it looks like you already are doing no more (and no less) than BFS.