You're given an undirected graph with n nodes and m edges, plus a starting node s. Every edge has a fixed weight of . Find the shortest distance from s to all other nodes. If a node is unreachable, report . Google graph interviews often involve BFS-based shortest path problems like this.
For a graph with nodes and edges (1,2) and (1,3), starting from node : node is distance , node is distance , and node is (unreachable).
Since all edges have the same weight, what single algorithm gives you shortest paths without Dijkstra?