Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
An undirected graph has the vertices J, K, M, O, P, Y and the edges P–M, P–Y, P–O, P–K, P–J, M–Y, M–O, Y–K, O–K. What is its chromatic number, the least number of colours needed to colour the vertices so that adjacent vertices differ?
- A. 6
- B. 4
- C. 2
- D. 3
Correct answer: D. 3
Searching colour counts from 1 upward finds 3 colours suffice and one fewer does not. Greedy colouring in label order uses 3, and the maximum degree bound gives 6; the clique number 3 is only a lower bound.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- A directed graph has the vertices B, F, I, S and the arcs I→F, I→S, F→I, F→B, S→I, S→F, S→B, B→F, B→S. Count the directed Hamiltonian…
- An undirected graph has the vertices L, O, Q, Y, Z and the edges L–Z, O–Z, O–Y, Q–O, Q–Y, L–Y, L–Q, Y–Z. What is the minimum number of…
- An undirected graph has the vertices C, E, L, M, T and the edges L–E, L–T, M–C, E–C, C–T. In how many ways can each vertex be given one of…
- A directed acyclic graph has the vertices A, F, H, I, K, Q, R and the edges A→H, Q→A, Q→F, Q→H, R→F, F→H, F→K, F→I. A topological order…
- A tree has the vertices A, E, H, P, R, S, T, U, W, Y and the edges H–T, T–E, T–A, E–P, T–Y, A–R, Y–S, R–U, U–W. A set D dominates the tree…
- An undirected connected graph on 6 vertices has the edges (weights in brackets, all distinct): H–E (26), O–E (23), B–O (5), V–U (8), V–B…