GATE / CS ARCHIVE

SIMILAR QUESTIONS / ALGORITHMS

Build the adjacent-label minimum spanning tree

3 questions solved the same way, newest first. Back to Algorithms

How these are solved

Complete graphs weighted by a positive constant times absolute label difference attain the universal (n−1)-edge lower bound with the consecutive-label chain. 1996 asks the tree drawing;

2 marks · NAT
Report issue

Asked again GATE 2006, Q11 (different numbers)

Graph Algorithms

Question 49, GATE 2020: The complete undirected graph has vertices v1,…,v100 and edge (vi,vj) for every 1≤i<j≤100, with weight |i−j|. Find its MST weight.
Tap to enlarge
Answer & solution

Official answer: 99

Worked explanation

A spanning tree is connected and acyclic on all 100 vertices, hence has exactly 99 edges. Here i≠j makes every weight |i−j| a positive integer, at least 1. Thus 99 is a universal lower bound. Choose precisely the edges (v1,v2),(v2,v3),…,(v99,v100). They form a path through every vertex, so are a valid spanning tree, and every edge has weight 1. Their sum is 99, attaining the bound. Taking all weight-one edges happens to work because they form this path; merely selecting individually cheap edges would not prove connectivity in a general graph.

Derivation and answer

Every edge has positive integer weight at least 1, and every spanning tree on 100 vertices has 99 edges, so its total weight is at least 99. The path v1-v2-...-v100 uses 99 consecutive-index edges of weight 1 and attains that bound. Hence the MST weight is 99.

Original paper, page 15 · Answer key

1 mark · MCQ
Report issue

Asked again GATE 2020, Q49 (different numbers)

Minimum spanning tree on indexed vertices

Graph Algorithms

Question 11, GATE 2006: A weighted complete graph has vertices v₁,…,vₙ and edge weight w(vᵢ,vⱼ)=2|i−j|. What is the minimum spanning-tree weight?
Options:
(A) n−1
(B) 2n−2
(C) C(n,2)
(D) n²
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Every edge has weight 2|i−j|≥2, so every spanning tree costs at least 2(n−1). The path v1,v2,...,vn uses n−1 edges of weight 2 and attains the bound.

2. Hence2n−2, B.

3. Teaching check: This is a lower-bound-plus-construction proof. Every spanning tree has exactly n−1 edges and every available edge costs at least two. Connecting consecutive indices achieves that lower bound; no search over all spanning trees is necessary.

Original paper, page 2

Descriptive
Report issue

Find an absolute-difference MST

Graph Algorithms

Question 16(a), GATE 1996: A complete undirected graph on vertices 0,1,…,n−1 has weight w(u,v)=|u−v| for distinct vertices. Draw a minimum spanning tree.
Question 16(a), GATE 1996: A complete undirected graph on vertices 0,1,…,n−1 has weight w(u,v)=|u−v| for distinct vertices. Draw a minimum spanning tree.
Tap to enlarge
Answer & solution

Answer: Path 0—1—2—…—(n−1), total weight n−1. (no official key was published)

Every edge joins distinct integers, so its weight is at least 1. A spanning tree on n vertices contains exactly n−1 edges. Consequently every spanning tree has total weight at least n−1.

Connect consecutive vertices: (0,1),(1,2),…,(n−2,n−1). This is a connected path with no cycles, so it is a spanning tree. Each of its n−1 edges has weight 1, giving total n−1 and attaining the lower bound. Text diagram: 0 --1-- 1 --1-- 2 --1-- … --1-- (n−1), where the labels between dashes are edge weights.

For n≥2 it is also the unique MST. Achieving the lower bound requires every selected edge to have weight 1, and the only weight-1 edges in this graph are exactly the consecutive pairs. There are n−1 of them, so all must be selected. Alternatively, for the cut {0,…,k}|{k+1,…,n−1}, edge (k,k+1) is the unique minimum crossing edge and is mandatory by the cut property. When n=1 the empty tree has cost 0; the same n−1 formula applies.

Original paper, page 9