# Breadth First Search Pseudocode **Published by:** [Untitled](https://paragraph.com/@0xbc8df8aee43c277a194e6c9829b06e8a59e2e521/) **Published on:** 2021-12-07 **URL:** https://paragraph.com/@0xbc8df8aee43c277a194e6c9829b06e8a59e2e521/breadth-first-search-pseudocode ## Content 1 procedure BFS(G, root) is 2 let Q be a queue 3 label root as explored 4 Q.enqueue(root) 5 while Q is not empty do 6 v := Q.dequeue() 7 if v is the goal then 8 return v 9 for all edges from v to w in G.adjacentEdges(v) do 10 if w is not labeled as explored then 11 label w as explored 12 Q.enqueue(w) ## Publication Information - [Untitled](https://paragraph.com/@0xbc8df8aee43c277a194e6c9829b06e8a59e2e521/): Publication homepage - [All Posts](https://paragraph.com/@0xbc8df8aee43c277a194e6c9829b06e8a59e2e521/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@0xbc8df8aee43c277a194e6c9829b06e8a59e2e521): Subscribe to updates