Area 1.2 : Graph Searching
Example :
Figure 2.1 : Graph Searching
1 : DFS
For a node u, we will search one of v that (u, v) is in E, then search v.
For instance, we search node 5 first. Then we will search 3, then 2, finally 1.
Figure 2.2-a : DFS Searching(a)
Now, we return until we find that there is still an not visited edge(Here we return to 3, then find (3, 8)). We’ll search 8, etc.
Figure 2.2-b : DFS Searching(b)
Here is the result :
Figure 2.2-c : DFS Searching(c)
2 : BFS
For a node u, we search all v that (u, v) is in E.
Another example, we search node 5, then we find 2, 3, 4, 6, 7.
Figure 2.3-a : BFS Searching(a)
Then we search 2, 3, 4, 6, 7, etc.
Figure 2.3-b : BFS Searching(b)
Here is the result :
Figure 2.3-c : BFS Searching(c)
Given Score :
Difficulty : 1
x Basic Score : 126
Score : 152
[Area 2 Unlocked]
All Figures in the passage :
http://59.60.22.18:2500/wordpress/wp-content/uploads/2024/01/C01_Figures.zip