Implement a breadth-first search to traverse a graph and return the shortest path length from a source node to all reachable nodes.