If all edges have equal weight (e.g., weight 1), BFS finds shortest paths. If weights are only 0 or 1, you can use 0–1 BFS with a deque; otherwise you need Dijkstra.