Skip to content
Official PYQ · 1997

GATE CS 1997 Q6.2 — Graphs

Explain with AI

Let GG be the graph with 100100 vertices numbered 11 to 100100.  Two vertices ii and jj are adjacent  if ∣i−j∣=8\vert i-j \vert =8 or ∣i−j∣=12\vert i-j \vert=12. The number of connected components in GG is

Choose one option
View worked solution

Answer: B

Two vertices ii and jj are adjacent if and only if ∣i−j∣=8|i - j| = 8 or ∣i−j∣=12|i - j| = 12.

If there exists a path between two vertices ii and jj, then their difference must be a linear combination of the step sizes 88 and 1212:

j−i=8x+12yfor some integers x,yj - i = 8x + 12y \quad \text{for some integers } x, y

By Bézout's identity, the set of all such linear combinations is precisely the set of multiples of the greatest common divisor:

gcd⁡(8,12)=4\gcd(8, 12) = 4

This implies that ii and jj can belong to the same connected component only if i≡j(mod4)i \equiv j \pmod 4. This partitions the 100100 vertices into 44 equivalence classes modulo 44:

  • C1={1,5,9,…,97}C_1 = \{1, 5, 9, \dots, 97\}
  • C2={2,6,10,…,98}C_2 = \{2, 6, 10, \dots, 98\}
  • C3={3,7,11,…,99}C_3 = \{3, 7, 11, \dots, 99\}
  • C4={4,8,12,…,100}C_4 = \{4, 8, 12, \dots, 100\}

Since we can transition by +4+4 using the sequence of steps +12+12 followed by −8-8 (and vice versa) without exceeding the boundaries [1,100][1, 100], each of these 44 equivalence classes is fully connected. Thus, there are exactly 44 connected components.

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

Published
Report a correction
Keep exploringMore Graphs questions