Graph Algorithms

Answer & solution
Answer: B (no official key was published)
Step through it (15 steps)
1. Kruskal processes edges by nondecreasing weight, accepting an edge only when its endpoints lie in different components.
2. Accept ac(1), ad(2); reject cd(2), since a,c,d are already connected. Accept bg(2), ei(2), then bd(3), which joins {b,g} with {a,c,d}.
3. Accept fh(4), hi(4), connecting {f,h} to {e,i}; accept ij(5) to add j. Reject ab(6), whose endpoints are already in the first component.
4. The two remaining components are {a,b,c,d,g} and {e,f,h,i,j}. Any weight-8 edge ae or gh can join them; choose gh. Nine accepted edges connect all ten vertices.
5. Total=1+2+2+2+3+4+4+5+8=31, B. eh(8) is internal to the second component and is not needed.
Solution: Kruskal's algorithm can select ac(1), ad(2), bg(2), ei(2), bd(3), fh(4), hi(4), ij(5), and gh(8). These nine edges connect all ten vertices without a cycle. Their total is 1+2+2+2+3+4+4+5+8=31, option B. The other weight-2 edge cd is skipped because ac and ad already connect c and d; the final weight-8 edge joins the two remaining components. Equal-weight alternatives may produce a different MST with the same total.