Try this exercise. Fill in the missing part by typing it in.
Graph traversal refers to the process of visiting all the ___ of a graph in a specific order.
There are two common algorithms for graph traversal: Depth First Search (DFS) and Breadth First Search (BFS).
In Depth First Search (DFS), we visit a vertex and then recursively visit all its __ vertices before backtracking. This means that we go as deep as possible before exploring other branches.
On the other hand, in Breadth First Search (BFS), we visit all the vertices at the __ level before moving to the next level.
For example, let's consider the following graph:
1 1
2 / \
3 2 3
4 \
5 4
Starting from vertex 1, the depth-first traversal would be 1 2 4 3, while the breadth-first traversal would be 1 2 3 4.
Both DFS and BFS are widely used in various graph algorithms and applications.
Write the missing line below.