Skip to content
Official PYQ · 2026

GATE CS 2026 Set 1 Q47 — Graphs: Connectivity, Matching, Colouring

Explain with AI
Let GG be an undirected graph, which is a path on 88 vertices. The number of matchings in GG is ____\_\_\_\_. (answer in integer)
View worked solution

Answer: 34 : 34

Let M(n)M(n) denote the number of matchings in a path graph PnP_n with nn vertices.

We can establish a recurrence relation for M(n)M(n) by considering the last vertex vnv_n in the path v1−v2−⋯−vnv_1 - v_2 - \dots - v_n:

  • Case 1: vnv_n is not matched. The remaining n−1n-1 vertices can be matched in M(n−1)M(n-1) ways.
  • Case 2: vnv_n is matched. It must be matched with its only neighbor vn−1v_{n-1}. The remaining n−2n-2 vertices can be matched in M(n−2)M(n-2) ways.

Thus, we obtain the recurrence relation:

M(n)=M(n−1)+M(n−2)for n≥3M(n) = M(n-1) + M(n-2) \quad \text{for } n \ge 3

The base cases are:

  • M(1)=1M(1) = 1 (the empty matching ∅\emptyset on a single vertex)
  • M(2)=2M(2) = 2 (the empty matching and the single-edge matching on two vertices)

Using the recurrence, we compute the values sequentially:

  • M(3)=M(2)+M(1)=2+1=3M(3) = M(2) + M(1) = 2 + 1 = 3
  • M(4)=M(3)+M(2)=3+2=5M(4) = M(3) + M(2) = 3 + 2 = 5
  • M(5)=M(4)+M(3)=5+3=8M(5) = M(4) + M(3) = 5 + 3 = 8
  • M(6)=M(5)+M(4)=8+5=13M(6) = M(5) + M(4) = 8 + 5 = 13
  • M(7)=M(6)+M(5)=13+8=21M(7) = M(6) + M(5) = 13 + 8 = 21
  • M(8)=M(7)+M(6)=21+13=34M(8) = M(7) + M(6) = 21 + 13 = 34

Therefore, the number of matchings in a path on 88 vertices is 34.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Graphs: Connectivity, Matching, Colouring questions