BFS Approach

Consider this graph with vertex S: