BFS explores a graph level by level, so it reaches each vertex by the fewest edges first. Use it for the shortest path in an unweighted graph, like the minimum moves in a maze or the degrees of separation between two people. Mark a vertex visited when you add it to the queue, or it can be added many times. When edges have different weights, BFS no longer gives shortest paths and you need Dijkstra.