Question: The examples of depth-first and breadth-first reachability given in the lecture notes assumed that the outgoing neighbors of each vertex were always listed in alphabetical
The examples of depth-first and breadth-first reachability given in the lecture notes assumed that the outgoing neighbors of each vertex were always listed in alphabetical order (so for instance when we loop over the neighbors of s we find a first, then b). Show what happens in the same algorithms, with the same starting vertex s, if the neighbors of each vertex are always listed in the reverse of alphabetical order. Suppose I give you a tree rooted at s that is either a DFS tree or a BFS tree for the same example graph given in the lecture notes, but I dont tell you whether I generated it using DFS or BFS, and I dont tell you the ordering of the neighbors that was used in the DFS or BFS. Describe in English an easy way to tell whether it is a DFS tree or a BFS tree. (Your answer only needs to work for this example; it does not need to be a general algorithm that works for all graphs.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
