Question

Question II - Graph Traversal and Minimum Spanning Trees [40 Points] Consider the following graph: B 10 1 4 1 H 9 4 a) Traver

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) Breadth First Search uses a queue data structure. First store the value for every node as 0 which shows node unvisited. Start entering the vertices into the queue if they are not visited. While removing the element from queue mark it as visited and enter the adjacent nodes if they are not visited.

BF5 TA А D Tolco E 0 3 o Ť clole [ CLO DIE E ELO F Telplan V Hlo G V Gle HI H BFS sequence : A, B, C, D,E,F,G,H N

(d) Depth First Search uses a stack data structure. First store the value for every node as 0 which shows node unvisited. Start pushing the vertices into the stack if they are not visited and mark it as visited and print it then Push the adjacent nodes. If there is no unvisited node available then pop.

Steps:

  1. If Unvisited
  2. Make visit = 1
  3. print node
  4. Push Adjacent node

POPA Push A DES(A) II. visita 2. Print A 3. A → B, C, D, E Push D Push B DES(B) DF5(0) I. visit et L. visit al PopB 12. print

DFS Sequence: ABCDEFGH

(c) In Kruskal's Algorithm choose the minimum available edge from the graph and check if it is forming a cycle with the spanning tree formed so far then discard the edge else include the edge in the spanning tree.

and Aitna um edge weight choose BC [D minenum edge weight. I AC has minimum edge weight. 2 c has FG, GH and will son equal mi

Now we will choose GH, NIE has 1 Now, HE is HF weight I but it the minimum cycle. So So we forming will discard has minimum e

(d) Weight of Minimum Spanning Tree = 1 + 3 + 6 + 1 + 5 + 4 + 4 = 24

If you're still having any doubt then please feel free to ask in the comment section.

Add a comment
Know the answer?
Add Answer to:
Question II - Graph Traversal and Minimum Spanning Trees [40 Points] Consider the following graph: B...
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
  • 3. In this problem, you will show the execution of the minimum spanning tree algorithms that...

    3. In this problem, you will show the execution of the minimum spanning tree algorithms that you studied in class on the following graph: START 10 40 5 20 35 15 6 30 62 12 (a) (5 points) Trace the execution of Prim's algorithm to find the minimum spanning tree for this graph. At each step, you should show the vertex and the edge added to the tree and the resulting values of D after the relaxation operation. Use START...

  • Minimum Spanning Trees Networks & Graphs 1. Create a spanning tree using the breadth-first search algorithm....

    Minimum Spanning Trees Networks & Graphs 1. Create a spanning tree using the breadth-first search algorithm. Start at A (i..0) and label cach vertex with the correct number after A and show your path. How many edges were used to create a spanning tree? 2. Create a spanning tree using the breadth-first search algorithm. Start at G (ie. O) and label each vertex with the correct number after A and show your path How many edges were used to create...

  • help with alogrthms Consider the following graph for problems 6, 7, & 8. (b f C...

    help with alogrthms Consider the following graph for problems 6, 7, & 8. (b f C d a (5 points) Starting at vertex a and resolving ties by the vertex alphabetical order, traverse the graph by depth-first search 7. and construct the corresponding depth-first search tree (5 points) Traverse the graph by breadth-first search and construct the corresponding breadth-first search tree. Start the 8. traversal at vertex a and resolve ties by the vertex alphabetical order. Consider the following graph...

  • 6. (6 points) Trace the execution of Kruskal's algorithm to find the Minimum Spanning Tree of...

    6. (6 points) Trace the execution of Kruskal's algorithm to find the Minimum Spanning Tree of the graph shown below. 5 10

  • For the following questions, use the graph (starting node: S) below: 14. Show DFS traversal. 15....

    For the following questions, use the graph (starting node: S) below: 14. Show DFS traversal. 15. Show BFS traversal. 16. Show the result of a topological sorting of the graph 17. Dijikstra's single source shortest paths for all nodes 18. Show a tabular form soultion of following 0/1 knapsack problem. Value {5,7, 3, 10, 12, 4, 10} Weight {2,3,1,5, 6, 2,4} Total Weight: 12 19. Show a solution to Fractional knapsack problem with the same weight, value, and total weight...

  • Problem A: Consider the following graph.

    Problem A: Consider the following graph. (a). Find a minimum spanning tree of the graph using Kruskal's algorithm. List the edges in the order they are put into the tree. (b). Apply Prim's algorithm to the same graph starting with node A. List the edges, in order added to the MST. (c). Suppose the cost of every edge touching node A is increased by a constant. Are we guaranteed that the MST remains the MST? Explain.

  • Consider the following weighted undirected graph.

    Consider the following weighted undirected graph. (a) Explain why edge (B, D) is safe. In other words, give a cut where the edge is the cheapest edge crossing the cut. (b) We would like to run the Kruskal's algorithm on this graph. List the edges appearing in the Minimum Spanning Tree (MST) in the order they are added to the MST. For simplicity, you can refer to each edge as its weight. (c) 1We would like to run the Prim's algorithm on this...

  • ​The weights of edges in a graph are shown in the table above. Find the minimum cost spanning tree on the graph above using Kruskal's algorithm.

    The weights of edges in a graph are shown in the table above. Find the minimum cost spanning tree on the graph above using Kruskal's algorithm. What is the total cost of the tree?

  • Use Kruskal's algorithm to find a minimum spanning tree for the graph. Indicate the order in which edges are added to form the tree.

    Use Kruskal's algorithm to find a minimum spanning tree for the graph. Indicate the order in which edges are added to form the tree. In what order were the edges added? (Enter your answer as a comma-separated list of sets.)

  • Consider the graph at right. 17 15 [a] In what order are the vertices visited using...

    Consider the graph at right. 17 15 [a] In what order are the vertices visited using DFS 319 1 starting from vertex a? Where a choice exists, use alphabetical order. What if you use BFS? [b A vertex x is "finished" when the recursive call DFS (x) terminates. In what order are the vertices finished? (This is different from the order in which they are visited, when DFS (x) is called.) [c] In what order are edges added to the...

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