BFS Approach

BFS first "visits" vertices that are adjacent to S, or at a distance of k = 1 from S: