IAE Academy

GATE 2024 CS2 Q.51: solution and answer

GATE 2024 · CS2Q.51 · 2 marks · MSQ

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

  1. (A)

    All edges in have even weight

  2. (B)

    All edges in have even weight OR all edges in have odd weight

  3. (C)

    In each cycle in , all edges in have even weight

  4. (D)

    In each cycle in , either all edges in have even weight OR all edges in have odd weight

See the question in the paper

Answer and solution

ANSWER

Only statement (D) is guaranteed true for every graph satisfying the hypothesis.

Official answer: DSource: Official answer key, GATE 2024 CS2 (IISc Bengaluru)

  1. Reduce the problem to edge-weight parities: let ; the hypothesis is that every spanning tree's weight is even, i.e., for every spanning tree .

  2. Take any simple cycle in and any edge . Removing from leaves a path (a forest), which can always be extended, in a connected graph, to a full spanning tree of that does not contain (adding back would close a cycle). Since is a tree, the unique path between 's endpoints inside must be exactly this path — so is precisely the fundamental cycle of with respect to .

  3. For every other edge of (so , lying on that tree path), the standard spanning-tree exchange property gives another spanning tree .

  4. Compare weights: . Since both and have even weight by hypothesis, subtracting mod 2 forces .

  5. Since was an arbitrary edge of , this parity-matching holds between every pair of edges of : all edges of any cycle in share the same parity (all even, or all odd). This is exactly statement (D), proved true for every graph satisfying the hypothesis.

  6. Kill (A) and (C): take a triangle with all three edges of weight . Every spanning tree is any of the edges, weight (even) — hypothesis holds. But the edges are all odd, not all even (kills A), and the triangle (the only cycle) does not have all-even edges (kills C). Note this example does not yet refute (B), since all edges here are uniformly odd, which satisfies B's second disjunct.

  7. Kill (B): take two triangles sharing exactly one vertex — one with all edges of weight (even), the other with all edges of weight (odd). Any spanning tree must use edges from each triangle (total edges for the vertices), and any such choice gives weight , always even — hypothesis holds. But the edges of are neither uniformly even (the odd triangle breaks this) nor uniformly odd (the even triangle breaks this), so (B) is false here.

  8. Since (A), (B), (C) each admit a counterexample while (D) was proved to hold for every valid , the only statement guaranteed TRUE for every such is (D).

KEY IDEA

Work with edge weights mod 2. If is any simple cycle and , then is a forest, which extends (using connectivity of ) to a spanning tree not containing ; since is a tree, the unique tree path between the endpoints of is exactly , so is precisely the fundamental cycle of with respect to . For any other edge of (so ), the tree is again a spanning tree of . Since both and must have even weight, . As was an arbitrary edge of , every edge of shares the same parity — this is exactly statement (D), and it holds for every graph satisfying the hypothesis.

WATCH OUT FOR

Assuming the hypothesis forces every edge weight to be even (choice A), or reasoning only about one spanning tree instead of using the exchange property across all spanning trees sharing a fundamental cycle; also mistakenly believing a "same overall parity across all edges" statement (B) follows, when two triangles of different fixed parities (one all-even, one all-odd) sharing a single vertex is a valid counterexample to B while still satisfying the hypothesis.

From the GATE 2024 CS2 paper. Every question of this paper · Download the full paper · All 28 Graph algorithms questions, with notes

More Graph algorithms questions