How does BFS guarantee the minimum path for this problem?
BFS (or Breadth-First Search) from its name implies that it will search for the destination along the breadth. That means it looks at all the current possible routes ie nodes connected to the current one and divides itself into all of those. Basically, at every junction, it divides itself and continues down that path until it encounters the destination node.
So effectively, it can be said that it checks for all the paths of length len from the source node starting len from 0 and incrementing it by 1 until it reaches the destination.
Let's say it got to the destination with length 7, now this means that it tried all the paths of length 0, 1, 2 ... 6 but was not able to get to the destination.
So, this means that whenever BFS finds a path, it already tried all paths of length (or cost) lower than the current one but was able to find a complete path that reaches the destination. Which means it always finds the shortest (or cheapest) path.