Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Notes/Day-13-graphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- Pros: **`O(V+E)`** memory and efficient to iterate neighbors - good for sparse graphs.
- Cons: Checking existence of a specific edge may be slower than with a matrix.
## Breadth-First Search (BFS):
BFS traverses a graph level by level (breadth-first). It explores all vertices at distance kkk from the start before vertices at distance **`k+1`**. BFS uses a **queue** to manage the frontier of vertices to visit.
BFS traverses a graph level by level (breadth-first). It explores all vertices at distance **`k`** from the start before vertices at distance **`k+1`**. BFS uses a **queue** to manage the frontier of vertices to visit.
### When to use BFS:
- Find the shortest path (fewest edges) in an unweighted graph.
- Test connectivity (reachability) from a source.
Expand Down
Loading