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
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