Question
solve for (B) only. the last number of my index number is "5" thank you
4. Using the graph below, o 8 9 3 7 6 4 5 a. Draw an adjacency list and matrix.[10 MARKS] b. Perform a depth first search usi
0 0
Add a comment Improve this question Transcribed image text
Answer #1

DFS traversal order:

5 3 1 2 4 8 0 9 7 6

Explanation with the tree is given below. Tree generation is shown stepwise. Step 10 contains the finally generated DFS tree. Step 4: visit vertex a add vertex I to stack ont of SOLUTION y Apresenti Step 1: Start with vertex 5 and explore vertex 5 5 SStep 5: Visit vertex 4 add vendex a to the Stack and verdey 4 vertex e as visited 5 ) Visited a 5.3. 1, 2, 4 Stack :9312 ②-③-

Step 7o Explore verder 8 ie, visit vertex o add it as visited and push verter 8 to the (5 visited: 5, 3, 1, 2, 4, 8,0 Stack:Step 98 Pop vertex I and visit vertex 7 and mark it as visited 5 Visited a 5,3,1,2,4,8,0 9,7 Stack: 5,3 7 ( 9 Step 10: Explos

Please upvote if you like the effort.

Add a comment
Know the answer?
Add Answer to:
solve for (B) only. the last number of my index number is "5" thank you 4....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Consider the directed graph on the right side of the following page and complete the...

    1. Consider the directed graph on the right side of the following page and complete the exercises below. When conducting a search, be very careful (since a small error early on can result in a large deduction of marks), and whenever you have a "choice" of which adjacent vertex to consider, you must consider the vertices in numerical order from least to greatest. (10 marks total) a. Provide an adjacency list representation of this graph. b. Compute the depth-first search...

  • 4&5 0 1 2 3 1. Draw the undirected graph that corresponds to this adjacency matrix...

    4&5 0 1 2 3 1. Draw the undirected graph that corresponds to this adjacency matrix 0 0 1 1 0 1 1 1 1 0 1 1 1 2 1 1 1 0 1 3 1 0 1 1 0 1 2. Given the following directed graph, how would you represent it with an adjacency list? 3. We've seen two ways to store graphs - adjacency matrices, and adjacency lists. For a directed graph like the one shown above,...

  • LAB 1 2 5 7 6 9 3 8 . Write code to implement an adjacency matrix (2d matrix) which represents th...

    JAVA LAB 1 2 5 7 6 9 3 8 . Write code to implement an adjacency matrix (2d matrix) which represents the graph. Your code should contain a function called addEdgelint i, int j). Use this function to add the appropriate edges in your matrix. Write code to implement Depth-First-Search (DFS) and Breadth-First-Search (BFS) of your graph. Let 0 be the source Node . Traverse the graph using DFS, print the Nodes as they are visited. . Traverse the...

  • 1. Startingatvertex000, perform a BFSof Q3.Assume all adjacency lists are in numericalorder.For example, (000,001) occurs before...

    1. Startingatvertex000, perform a BFSof Q3.Assume all adjacency lists are in numericalorder.For example, (000,001) occurs before (000, 010). Showthe resulting spanningtrees. Draw the directed graphs and perform a. 2. Breadth-First Search (BFS)algorithm: VTo determine the shortest paths starting at vertex a to everyother node. Show the resulting spanning tree. b. Depth-First Search (DFS) to explore the whole graph: Record the start/end time for all the vertices. show the resulting spanning forest Label the name°fthe edges. V Writethetopologicalorderofthevertices(ifnocycle-nobackedge) (Showthestate of the...

  • 3. (8 points-7+1) Figure 4 shows an undirected graph G. Assume that the adjacency list lists the ...

    3. (8 points-7+1) Figure 4 shows an undirected graph G. Assume that the adjacency list lists the edges in alphabetical order. Figure 3: Graph for P3 (a) Apply depth first search (DFS) to graph G, and show the discovery and finish times of each vertex. In the main-loop of DFS, check the vertices in alphabetical the form dsc/fin, where dsc is the discovery time and fin is the finish time. (b) Draw the DFS tree obtained. 3. (8 points-7+1) Figure...

  • 3. Given a directed graph G < V E >, we define its transpose Gr < V.E1 > to be the graph such tha...

    3. Given a directed graph G < V E >, we define its transpose Gr < V.E1 > to be the graph such that ET-{ < v, u >:< u, v >EE). In other words, GT has the same number of edges as in G, but the directions of the edges are reversed. Draw the transpose of the following graph: ta Perform DFS on the original graph G, and write down the start and finish times for each vertex in...

  • Please help me with 2 (c), thank you!!! Figure 2: 4 10 Figure 3:1 4 Problems 1. Trace BFS on the following graphs. For...

    Please help me with 2 (c), thank you!!! Figure 2: 4 10 Figure 3:1 4 Problems 1. Trace BFS on the following graphs. For each vertex, record its color, parent, and distance fields, draw the resulting BFS tree, and determine the order in which vertices are added to the Queue. Process adjacency lists in ascending numerical order. a. The graph in figure 1, with 1 as the source. b. The directed graph in figure 2 with 1 as source. 2....

  • 1. Use the following graph for the questions. Show all the steps (a) Draw the adjacency...

    1. Use the following graph for the questions. Show all the steps (a) Draw the adjacency matrix and the adjacency list (b) Using the Depth First Search algorithm learned in class, topologically sort the graph. 4 t5 64 (c) Use Dijstra's algorithm to determine the shortest path from node s to all other nodes. (d) Use Bellman-Ford's algorithm to determine the shortest path from node s to all other nodes.

  • please I need it urgent thanks algorithms second picture is the graph 2.3 Graphs and BFS-DFS...

    please I need it urgent thanks algorithms second picture is the graph 2.3 Graphs and BFS-DFS 5 points each I. Draw the adjacency matrix for the graph A on the last page. 2. Show the order in which a breadth first traversal will print out the vertices? Assume that if the algorithm has a choice of which vertex to visit, it visits the vertex with the lower number. 3. Find a topological ordering for the graph B on the last...

  • refer to the question using c++. if you could not do the bonus part no problem you don't have too , but if you can so please do it and let me know Create an unweighted undirected Graph Class usin...

    refer to the question using c++. if you could not do the bonus part no problem you don't have too , but if you can so please do it and let me know Create an unweighted undirected Graph Class using an Adjacency Matrix with the following functions 1. Graph(int numofV) 3. int noOfOutgoingEdges(int vertex); 4. int noOflncomingEdges (int vertex) 5. void print) You may use vectors/2D dynamic arrays to implement the matrix. Bonus (20) 6. void DFS(); Depth First Search...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT