Question: Depth-first search dfs and breath-first search bfs graph traversal algorithms are applied to a rectangular grid of size n times n. The vertices of the

Depth-first search dfs and breath-first search bfs graph traversal algorithms are applied to a rectangular grid of size n times n. The vertices of the rectangular grid have the form (ij), where ij-1,2,3,..,n, and the edges connect pairs (ij), (i+j) and (ij), ij+1). What are the maximal numbers of vertices occurring inside the stack of the dfs and inside the queue of the bfs during the execution? How many back arcs in the case of the dfs are there? How many cross arcs in the case of the bfs are there? Draw the spanning trees for both algorithms in the case n-4.Assume lexicographic ordering of vertices, ie. (iluj 1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
