Computer Sciences > GATE 2026 SET-1 > Graph Algorithms
An undirected, unweighted, simple graph G(V, E) is said to be 2-colorable if there exists a function c: V → {0, 1} such that for every (u, v) ∈ E, c(u) ≠ c(v).

Which of the following statements about 2-colorable graphs is/are true?
A
If G is 2-colorable, then G may contain cycles of odd length
B
If G is 2-colorable, then G may contain cycles of even length
C
An optimal algorithm for testing whether G is 2-colorable runs in time Θ(|V| + |E|), if G is represented as an adjacency list
D
An optimal algorithm for testing whether G is 2-colorable runs in time Θ(|E| log|V|), if G is represented as an adjacency list

Correct : b,c

To evaluate the statements about 2-colorable graphs, we need to apply the fundamental properties of graph theory and algorithmic time complexities.
1. What is a 2-Colorable Graph?
A graph is 2-colorable if we can assign one of two colors to each vertex such that no two adjacent vertices share the same color. By definition, a graph is 2-colorable if and only if it is a bipartite graph.
2. Evaluating the Options:
A) If G is 2-colorable, then G may contain cycles of odd length.
A core property of bipartite graphs is that they cannot contain any cycles of odd length. For example, if you try to 2-color a triangle (a cycle of length 3), the third vertex will inevitably be adjacent to both color 0 and color 1, requiring a third color. Therefore, this statement is False.
B) If G is 2-colorable, then G may contain cycles of even length.
Bipartite graphs can absolutely contain cycles of even length. A simple square (a cycle of length 4) can easily be colored with an alternating 0-1-0-1 pattern. Therefore, this statement is True.
C) An optimal algorithm for testing whether G is 2-colorable runs in time Θ(|V| + |E|), if G is represented as an adjacency list.
To test if a graph is bipartite (2-colorable), we can use standard graph traversal algorithms like Breadth-First Search (BFS) or Depth-First Search (DFS). We start by coloring a source node with color 0, its neighbors with color 1, their neighbors with color 0, and so on. If we ever find an edge connecting two nodes of the same color, it is not 2-colorable. Using an adjacency list, BFS and DFS run in linear time relative to the size of the graph, which is Θ(|V| + |E|). This is optimal. Therefore, this statement is True.
D) An optimal algorithm for testing whether G is 2-colorable runs in time Θ(|E| log|V|), if G is represented as an adjacency list.
As established in statement C, the optimal time is Θ(|V| + |E|). An algorithm running in Θ(|E| log|V|) would be slower and sub-optimal. Therefore, this statement is False.
Correct Answers: B, C

Similar Questions

Let G(V,E) be an undirected and unweighted graph with 100 vertices. Let d(u,v) denote the number of edges in a shortest path between vertices u and v in V. Let...
#1386 MCQ
Let G be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant a is added to the weight of every edge. Which ONE of the foll...
#1445 MCQ
Consider the following algorithm someAlgo that takes an undirected graph G as input. The output of someAlgo (T) for the tree shown in the given figure is _____...
#1466 NAT

Related Topics

2-colorable graphs bipartite graph properties optimal algorithm 2-coloring BFS bipartite check DFS 2-colorable time complexity graph theory GATE questions odd length cycles bipartite even length cycles graph theory GATE CS algorithms

Unique Visitor Count

Total Unique Visitors

Loading......