GATE Computer ScienceHardGATE CS (PYQ pattern)

An undirected graph has edges 1-2, 2-3, 3-4, 4-5, 5-6, 6-1, 2-7, 7-8, 8-9, 9-7, 4-10, 10-11. Vertices are coloured by the parity of their BFS distance from vertex 1. How many edges join two vertices of the same colour (i.e. are monochromatic)?

  1. A. 2
  2. B. 1
  3. C. 3
  4. D. 0

Correct answer: B. 1

The hexagon 1-2-3-4-5-6 is an even cycle and is properly coloured, but the triangle 7-8-9 is an odd cycle, so any 2-colouring (BFS parity included) must leave exactly 1 of its edges monochromatic.

More Programming and Data Structures (GATE) questions

Exams that ask this topic