To implement graph traversals using:
A graph is a data structure consisting of vertices (nodes) and edges (connections).
BFS (Breadth-First Search): Traverses level by level using a queue.
DFS (Depth-First Search): Explores as deep as possible along a branch using recursion or a stack.
| Feature | BFS | DFS |
|---|---|---|
| Uses | Queue (FIFO) | Stack (LIFO) or Recursion |
| Best For | Finding the shortest path | Pathfinding & connectivity |
| Time Complexity | O(V + E) | O(V + E) |
Conclusion : Hence we have performed our practical successfully