Don't get confuse here between Prims algorithm and BFS.
We don't have any concern of edge weights in BFS. In prims algo we take edge weights in consideration.
So, if we traverse a graph using BFS we will get the shortest path from "Source" to every vertex in the graph.(here source is W).
Here path means no of edges.
Correct me if I'm wrong.