I\'ve done some research, and I seem to be missing one small part of this algorithm. I understand how a Breadth-First Search works, but I don\'t understand how exactly it wi
Based on acheron55 answer I posted a possible implementation here.
Here is a brief summery of it:
All you have to do, is to keep track of the path through which the target has been reached.
A simple way to do it, is to push into the Queue
the whole path used to reach a node, rather than the node itself.
The benefit of doing so is that when the target has been reached the queue holds the path used to reach it.
This is also applicable to cyclic graphs, where a node can have more than one parent.