unrolling the string in more conservative manner bfs starts at vertex swhich is at level and defines the "anchorfor our string in the first roundwe let out the string the length of one edge and we visit all the vertices we can reach without unrolling the string any farther in this casewe visitand paint as "visited,the vertices adjacent to the start vertex --these vertices are placed into level in the second roundwe unroll the string the length of two edges and we visit all the new vertices we can reach without unrolling our string any farther these new verticeswhich are adjacent to level vertices and not previously assigned to levelare placed into level and so on the bfs traversal terminates when every vertex has been visited pseudo-code for bfs starting at vertex is shown in code fragment we use auxiliary space to label edgesmark visited verticesand store collections associated with levels that isthe collections and so onstore the vertices that are in level level level and so on these collections couldfor examplebe implemented as queues they also allow bfs to be nonrecursive code fragment the bfs algorithm we illustrate bfs traversal in figure