Graph Algorithms questions

Q41

GATE CS 2026 CS-1Graph AlgorithmsMCQ2 marks−2/3 if wrong
Let G(V,E)G(V, E) be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the number of edges in that path.

Let s∈Vs \in V be a vertex in GG. For every u∈Vu \in V and for every k≥0k \ge 0, let dk(u)d_k(u) denote the weight of a shortest path (in terms of weight) from ss to uu of length at most kk. If there is no path from ss to uu of length at most kk, then dk(u)=∞d_k(u) = \infty.

Consider the statements:
S1: For every k≥0k \ge 0 and u∈Vu \in V, dk+1(u)≤dk(u)d_{k+1}(u) \le d_k(u).
S2: For every (u,v)∈E(u, v) \in E, if (u,v)(u, v) is part of a shortest path (in terms of weight) from ss to vv, then for every k≥0k \ge 0, dk(u)≤dk(v)d_k(u) \le d_k(v).

Which one of the following options is correct?
Show answer without attempting

Answer: A

Q49

GATE CS 2026 CS-1Graph AlgorithmsMSQ2 marks
Let G(V,E)G(V, E) be a simple, undirected, edge-weighted graph with unique edge weights.

Which of the following statements about the minimum spanning trees (MST) of GG is/are true?
More than one option can be correct.
Show answer without attempting

Answer: A, D

Q50

GATE CS 2026 CS-1Graph AlgorithmsMSQ2 marks
Consider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graph G(V,E)G(V, E) as input, where d[v]d[v] and f[v]f[v] are the discovery time and finishing time, respectively, of the vertex v∈Vv \in V.
DFS(G):
 unmark all v in V
 t <- 0
 for each v in V
 if v is unmarked
 t <- Explore(G, v, t)
 end if
 end for

Explore(G, v, t):
 mark v
 t <- t + 1
 d[v] <- t
 for each (v, w) in E
 if w is unmarked
 t <- Explore(G, w, t)
 end if
 end for
 t <- t + 1
 f[v] <- t
 return t
Suppose that the input directed graph G(V,E)G(V, E) is a directed acyclic graph (DAG).
For an edge (u,v)∈E(u, v) \in E, which of the following options will NEVER be correct?
More than one option can be correct.
Show answer without attempting

Answer: B, D

Q55

GATE CS 2026 CS-1Graph AlgorithmsMSQ2 marks
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 \to \{0, 1\} such that for every (u,v)∈E(u, v) \in E, c(u)≠c(v)c(u) \neq c(v).

Which of the following statements about 2-colorable graphs is/are true?
More than one option can be correct.
Show answer without attempting

Answer: B, C

Q37

GATE CS 2026 CS-2Graph AlgorithmsMCQ2 marks−2/3 if wrong
Let GG be a weighted directed acyclic graph with mm edges and nn vertices. Given GG and a source vertex ss in GG, which one of the following options gives the worst case time complexity of the fastest algorithm to find the lengths of shortest paths from ss to all vertices that are reachable from ss in GG?
Show answer without attempting

Answer: A

0/50 correct0 marks

Related topics in Algorithms