Skip to main content

GATE CSE 2026Graph Theory › Graph Isomorphism, Matching & CountingVerified

GATE CSE 2026 PYQ: An undirected, unweighted, simple graph G ( V , E ) G(V, E) G ( V , E ) is said to be 2 2 2 -colorable if…

An undirected, unweighted, simple graph G(V,E)G(V, E) is said to be 2-colorable if there exists a function c:V→{0,1}c: V \rightarrow\{0,1\} such that for every (u,v)∈E,c(u)≠c(v)(u, v) \in E, c(u) \neq c(v).

Which of the following statements about 2-colorable graphs is/are true?

  1. A
    If GG is 2-colorable, then GG may contain cycles of odd length
  2. B
    If GG is 2-colorable, then GG may contain cycles of even length
    Correct answer
  3. C
    An optimal algorithm for testing whether GG is 2-colorable runs in time Θ(∣V∣+∣E∣)\Theta(|V|+|E|), if GG is represented as an adjacency list
    Correct answer
  4. D
    An optimal algorithm for testing whether GG is 2-colorable runs in time Θ(∣E∣log⁡∣V∣)\Theta(|E| \log |V|), if GG is represented as an adjacency list

Answer

(B, C) If G G G is 2 2 2 -colorable, then G G G may contain cycles of even length; An optimal algorithm for testing whether G G G is 2 2 2 -colorable runs in time Θ ( ∣ V ∣ + ∣ E ∣ ) \Theta(|V|+|E|) Θ ( ∣ V ∣ + ∣ E ∣ ) , if G G G is represented as an adjacency list

Approach

A 2-colorable graph is exactly a bipartite graph: its vertex set splits into two independent sets. The key structural characterization is that a graph is bipartite if and only if it contains no odd-length cycle, which immediately settles the cycle statements. The algorithmic statements are settled by recognizing that 2-coloring is tested by a simple BFS/DFS traversal that colors each vertex opposite to its predecessor and reports failure when an edge joins two same-colored vertices; such a traversal touches every vertex and every edge once.

Interpreting 2-colorability as bipartiteness, the structural fact 'bipartite iff no odd cycle' makes A false and B true. For an adjacency-list representation, the standard BFS/DFS coloring test runs in Θ(|V|+|E|), matching the trivial lower bound of reading the input, so C is true and the slower Θ(|E| log |V|) claim in D is false. Hence the correct selections are B and C.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.