What is the general idea of using breadth-first over the default depth-first search scheme in Prolog?
Not taking infinite branches?
Is there any general way to use breadth-first in Prolog? I've been googling around and I didn't find too much useful info for a novice.
The advantage of breadth-first is that you will find all solutions. With depth-first you can become stuck in an infinite branch.
The disadvantage is that breadth-first uses a lot of memory, therefore it is not used generally for execution.
If you want to use it you'll need to implement it explicitly with some kind of queue.
Edit: If you want to have the advantages of breadth-first search without using much memory you can use iterative deepening. This is depth-first search with a depth-bound, which you increase successively. This causes some duplicate computation, but if your search space doesn't have long linear stretches without branching then this duplication is small.