Motivation for BFS [00ML]

DFS can find a path between given vertices, if one exists; but it is not guaranteed to find the shortest path. For example, consider the graph consisting of four vertices connected into a cycle. The shortest path from any vertex to an adjacent vertex is clearly of length 1; but if DFS happens to search in the other direction first, it will find the path of length 3 instead.

So, if we want to find not just any path between vertices in a graph, but the shortest path, what can we do? This is a natural question in many contexts, where the shortest path corresponds to a cheapest/quickest/simplest solution.