Question: Exercise 1 . Traversals Let G be a graph with 8 nodes labeled A , B , C , D , E , F ,

Exercise 1. Traversals
Let G be a graph with 8 nodes labeled A, B, C, D, E, F, H, J, and let the adjacent nodes of each node be as follows:
A(B,C,D),B(A,C,D),C(A,B,D),D(A,B,C,F),E(F,H,J),F(D,E,H),H(E,F,J),H(E,H)
a) Draw G. Also show the adjacency matrix for G.
b) On a copy of G, label the nodes with numbers 1..8 to show the order in which they would be visited in a DFS traversal starting at node A. Also, show which are the discovery edges by making them red and directed (alternately, make them thicker rather than red).
NOTE: for your traversals, assume that the adjacent nodes of any given node are returned in the same order as they are listed above.
c) On a copy of G, label the nodes with numbers 1..8 to show the order in which they would be visited in a BFS traversal starting at node A. Also, show which are the discovery edges by making them red and directed (alternately, make them thicker rather than red).
NOTE: the discovery edges should form a tree rooted at A, aka search tree.
Exercise 1 . Traversals Let G be a graph with 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!