BFS example with different starting vertex
Example: bfs
function breadthFirstSearch (Start, Goal)
{
enqueue(Queue,Start)
setVisited(start)
while notEmpty(Queue)
{
Node := dequeue(Queue)
if Node = Goal
{
return Node
}
for each Child in Expand(Node)
{
if notVisited(Child)
{
setVisited(Child)
enqueue(Queue, Child)
}
}
}
}