GATE CS 2024 Set 2 — Question 59

NAT+2 / -0HardTrees & Spanning TreesGraph Theory (Math)Engineering MathematicsKruskal's MSTGreedy AlgorithmsAlgorithms

Algorithms → Graph Theory (Math) → Kruskal's MST

Last updated

Question

The number of distinct minimum-weight spanning trees of the following graph is _________
Graph with nodes a, b, c, d, e, f, g. Edges and weights: (a,b)=1, (b,c)=3, (c,d)=1, (d,e)=1, (e,f)=3, (f,a)=1, (a,g)=2, (b,g)=2, (c,g)=2, (d,g)=2, (e,g)=2, (f,g)=2

Correct answer

9 to 9

Solution

To find the number of distinct Minimum Spanning Trees (MSTs), we can use Kruskal's algorithm logic, considering edges in increasing order of weights.
Step 1: Edges with weight 1
Edges: (a,b)(a, b), (f,a)(f, a), (c,d)(c, d), (d,e)(d, e).
There are 4 such edges. None of them form a cycle among themselves.
  • (a,b)(a, b) and (f,a)(f, a) connect nodes {a,b,f}\{a, b, f\}.
  • (c,d)(c, d) and (d,e)(d, e) connect nodes {c,d,e}\{c, d, e\}.

Since these edges must be included in any MST (as they are the unique smallest weights connecting these nodes), we include all 4 edges.
Current components: C1={a,b,f}C_1 = \{a, b, f\}, C2={c,d,e}C_2 = \{c, d, e\}, C3={g}C_3 = \{g\}.
Step 2: Edges with weight 2
Edges connecting to gg: (a,g),(b,g),(f,g)(a, g), (b, g), (f, g) connect C1C_1 to gg. (c,g),(d,g),(e,g)(c, g), (d, g), (e, g) connect C2C_2 to gg.
We need to connect the three components C1,C2,C3C_1, C_2, C_3 together. The MST requires V1=71=6V-1 = 7-1 = 6 edges. We currently have 4 edges. We need 2 more edges.
To connect C1C_1 to gg, we can choose any one edge from the set {(a,g),(b,g),(f,g)}\{(a, g), (b, g), (f, g)\}. All have weight 2. Since they all connect the same two components (C1C_1 and gg), any one of them is valid and will not form a cycle with the others if only one is picked.
Number of choices = 3.
To connect C2C_2 to gg, we can choose any one edge from the set {(c,g),(d,g),(e,g)}\{(c, g), (d, g), (e, g)\}. All have weight 2.
Number of choices = 3.
By picking one edge from the first set and one from the second set, we connect C1gC2C_1-g-C_2, forming a single connected component containing all vertices. No cycles are formed.
Step 3: Edges with weight 3
Edges (b,c)(b, c) and (e,f)(e, f) have weight 3. Since the graph is already connected using weights 1 and 2, adding any weight 3 edge would create a cycle. Thus, no weight 3 edges are included.
Total Distinct MSTs
Total combinations = (Choices for connecting C1C_1 to gg) ×\times (Choices for connecting C2C_2 to gg)
Total = 3×3=93 \times 3 = 9.

More questions on Graph Theory (Math)

Practice GATE CS PYQs with adaptive difficulty

Timed practice, skill tracking, and AI explanations — free to start.

Start practicing free