GATE CS 2026 Set 1 | Question 55
Algorithms › Graph Algorithms · MSQ · 2 marks · Answer: B, C
- Question 55Algorithmsmsq2 marksAn undirected, unweighted, simple graph is said to be 2-colorable if there exists a function such that for every , . Which of the following statements about 2-colorable graphs is/are true?
- A.If is 2-colorable, then may contain cycles of odd length
- B.If is 2-colorable, then may contain cycles of even length✓
- C.An optimal algorithm for testing whether is 2-colorable runs in time , if is represented as an adjacency list✓
- D.An optimal algorithm for testing whether is 2-colorable runs in time , if is represented as an adjacency list
Answer: B, C
Solution
Answer: B, C 2-colourable is the same as bipartite, which is the same as having no odd cycle. So (A) is false and (B) is true (for example ). BFS or DFS colouring checks every edge once, in time. That is optimal, because every edge must be read. So (C) is true and (D) false. - A.
More GATE PYQ on Graph Algorithms
All GATE CS Algorithms PYQ →Attempt GATE CS 2026 Set 1 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →