Machine-translated by Google. Questions are authored in English.
Top

Trees and Spanning Trees Questions and Answers

1.

Let \(G\) be a weighted connected undirected graph with distinct positive edge weights. If every edge weight is increased by the same value, then which of the following statements is/are TRUE?

P: Minimum spanning tree of \(G\) does not change
Q: Shortest path between any pair of vertices does not change

Exam Year(s)

GATE CS - 2016,

Answer: A

The answer is P only.

P is true. Every spanning tree has exactly \(|V| - 1\) edges, so adding the same constant to every edge raises every tree's total by the same amount. The order of trees by weight is unchanged, and so is the minimum spanning tree. (Kruskal's algorithm also sees the same order of edges.)

Q is false. Paths have different numbers of edges, so the increase depends on path length. For example, a direct edge of weight 6 against a two-edge path of weights 2 + 3: before, the two-edge path (5) is shorter; after adding 2 to each edge, it costs 9 while the direct edge costs 8. Paths with more edges are penalized more.

Please log in or register to report this question.

2.

\(G = (V, E)\) is an undirected simple graph in which each edge has a distinct weight, and \(e\) is a particular edge of \(G\). Which of the following statements about the minimum spanning trees (MSTs) of \(G\) is/are TRUE?

I. If \(e\) is the lightest edge of some cycle in \(G\), then every MST of \(G\) includes \(e\)
II. If \(e\) is the heaviest edge of some cycle in \(G\), then every MST of \(G\) excludes \(e\)

Exam Year(s)

GATE CS - 2016,

Answer: B

Only statement II is true, so the answer is II only.

II is true (the cycle property): if \(e\) is the heaviest edge on some cycle, then in any spanning tree containing \(e\), removing \(e\) and adding another edge of that cycle reconnects the tree with smaller total weight. So no MST contains \(e\).

I is false. Being the lightest edge of some cycle does not force an edge into the MST. Take vertices A, B, C, D with edges AC = 1, BC = 2, AB = 3, AD = 4 and BD = 5. AB is the lightest edge of the cycle A-B-D (3, 4, 5), yet it is the heaviest edge of the triangle A-B-C, so by the cycle property no MST contains it; the MST is AC, BC, AD. So only II holds.

Please log in or register to report this question.

3.

Let \(G\) be any undirected graph with positive edge weights, and \(T\) be a minimum spanning tree of \(G\). For any two vertices, \(u\) and \(v\), let \(d_{1}(u, v)\) and \(d_{2}(u, v)\) be the shortest distances between \(u\) and \(v\) in \(G\) and \(T\), respectively. Which ONE of the options is CORRECT for all possible \(G\), \(T\), \(u\) and \(v\)?

Exam Year(s)

GATE CS - 2025,

Answer: B

For all graphs, \(d_{1}(u, v) \le d_{2}(u, v)\).

The minimum spanning tree T is a subgraph of G, so the unique path between u and v in T is also a path in G. The shortest path in G can only be as short as that path or shorter, so \(d_{1} \le d_{2}\).

Equality need not hold, because an MST minimises total weight, not individual distances. In a triangle with edges u-v of weight 3 and u-w, w-v of weight 2 each, the MST keeps the two edges of weight 2, so \(d_{2}(u, v) = 4\) while \(d_{1}(u, v) = 3\). That example rules out '=' and '\(\ge\)', and the case where u and v are joined by an MST edge rules out '\(\ne\)'.

Please log in or register to report this question.

4.

Let \(G\) be an undirected connected graph in which every edge has a positive integer weight. Suppose that every spanning tree in \(G\) has even weight. Which of the following statements is/are TRUE for every such graph \(G\) ?

Exam Year(s)

GATE CS - 2024,

Answer: D

The true statement is In each cycle \(C\) in \(G\), either all edges in \(C\) have even weight OR all edges in \(C\) have odd weight.

Suppose a cycle had an even edge e and an odd edge f. Take a spanning tree that contains e but not f (start from the cycle minus f and extend it). Removing e splits the tree into two parts, and f, lying on the same cycle, reconnects them, so swapping e for f gives another spanning tree whose weight differs by an odd amount. Both trees cannot be even, a contradiction. So the edges of every cycle share one parity.

The other statements fail on examples. A path of two edges of weight 1 has only one spanning tree, of weight 2, so edges need not be even, and a cycle of odd edges does the same. A triangle of odd edges with a pendant edge of weight 2 has every spanning tree of even weight, yet its edges are neither all even nor all odd.

Please log in or register to report this question.

5.

Let \(G\) be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant \(\alpha\) is added to the weight of every edge.

Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in \(G\) before and after the edge weight update?

Exam Year(s)

GATE CS - 2025,

Answer: C

Every MST remains an MST, and SPs need not remain SPs.

Every spanning tree of a graph with n vertices has exactly n - 1 edges. Adding α to every edge raises the weight of every spanning tree by the same amount, (n - 1)α, so their order by weight is unchanged and the minimum ones stay minimum.

Paths are different: a path with k edges gains kα, so paths with more edges are penalised more. Example: a direct edge u-v of weight 3 against a two-edge path u-w-v of weights 1 and 1. Before the update the two-edge path (2) is shorter; after adding α = 2 it costs 6 while the direct edge costs 5. So a shortest path need not stay shortest, which rules out the two options claiming that every SP survives, and the MST argument rules out the other.

Please log in or register to report this question.

6.

Consider a complete graph \(K_{n}\) with \(n\) vertices (\(n \gt 4\)). Note that multiple spanning trees can be constructed over \(K_{n}\). Each of these spanning trees is represented as a set of edges. The Jaccard coefficient between any two sets is defined as the ratio of the size of the intersection of the two sets to the size of the union of the two sets.

Which one of the following options gives the lowest possible value for the Jaccard coefficient between any two spanning trees of \(K_{n}\) ?

Exam Year(s)

GATE CS - 2026,

Answer: C

The lowest possible Jaccard coefficient is 0.

The coefficient is |T1 ∩ T2| / |T1 ∪ T2|, so it is 0 exactly when two spanning trees share no edge. Kn has n(n-1)/2 edges and a spanning tree uses n - 1, so there are more than enough edges for two disjoint trees once n ≥ 4.

A concrete pair for n > 4, with vertices 1 to n: the path 1-2-3-...-n, and the path that visits the odd vertices in increasing order and then the even ones (1-3-5-...-2-4-6-...). Every edge of the second path joins two numbers that differ by at least 2, while every edge of the first joins consecutive numbers, so the two spanning trees share no edge and their Jaccard coefficient is 0.

The other values assume two trees must share an edge: 1/(2n-3) is the value when they share exactly one edge (union 2(n-1) - 1 = 2n - 3), and 1/n and 1/(n-1) are not minimal.

Please log in or register to report this question.

Loading…
Tags: Trees and Spanning Trees Questions and Answers || Trees and Spanning Trees MCQ Questions and Answers || Trees and Spanning Trees GK Questions and Answers || Trees and Spanning Trees GK MCQ Questions || Trees and Spanning Trees Multiple Choice Questions and Answers || Trees and Spanning Trees GK || GK on Trees and Spanning Trees || Discrete Mathematics Questions and Answers || Discrete Mathematics MCQ Questions and Answers || Discrete Mathematics GK Questions and Answers || GK on Discrete Mathematics