Graph Algorithms questions — page 1 of 3

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

Q18

GATE CS 2025 CS-1Graph AlgorithmsMCQ1 mark−1/3 if wrong
Let GG be any undirected graph with positive edge weights, and TT be a minimum spanning tree of GG. For any two vertices, uu and vv, let d1(u,v)d_1(u, v) and d2(u,v)d_2(u, v) be the shortest distances between uu and vv in GG and TT, respectively. Which ONE of the options is CORRECT for all possible G,T,uG, T, u and vv?
Show answer without attempting

Answer: B

Q43

GATE CS 2025 CS-1Graph AlgorithmsMCQ2 marks−2/3 if wrong
Let G(V,E)G(V, E) be an undirected and unweighted graph with 100 vertices. Let d(u,v)d(u, v) denote the number of edges in a shortest path between vertices uu and vv in VV. Let the maximum value of d(u,v)d(u, v), u,v∈Vu, v \in V such that u≠vu \neq v, be 30. Let TT be any breadth-first-search tree of GG. Which ONE of the given options is CORRECT for every such graph GG?
Show answer without attempting

Answer: C

Q64

GATE CS 2025 CS-1Graph AlgorithmsNAT2 marks
The maximum value of xx such that the edge between the nodes B and C is included in every minimum spanning tree of the given graph is _________ . (answer in integer)
Question figure
Show answer without attempting

Answer: 5

Q29

GATE CS 2025 CS-2Graph AlgorithmsMSQ1 mark
Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph G is/are TRUE?
More than one option can be correct.
Show answer without attempting

Answer: B, C, D

Q37

GATE CS 2025 CS-2Graph AlgorithmsMCQ2 marks−2/3 if wrong
Let GG be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant α\alpha is added to the weight of every edge.

Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in GG before and after the edge weight update?
Show answer without attempting

Answer: C

Q59

GATE CS 2025 CS-2Graph AlgorithmsNAT2 marks
Consider the following algorithm someAlgo that takes an undirected graph GG as input.

someAlgo(GG)
1. Let vv be any vertex in GG. Run BFS on GG starting at vv. Let uu be a vertex in GG at maximum distance from vv as given by the BFS.
2. Run BFS on GG again with uu as the starting vertex. Let zz be the vertex at maximum distance from uu as given by the BFS.
3. Output the distance between uu and zz in GG.

The output of someAlgo(TT) for the tree shown in the given figure is ___________. (Answer in integer)
Question figure
Show answer without attempting

Answer: 6

Q45

GATE CS 2024 CS-1Graph AlgorithmsMSQ2 marks
Let GG be a directed graph and TT a depth first search (DFS) spanning tree in GG that is rooted at a vertex vv. Suppose TT is also a breadth first search (BFS) tree in GG, rooted at vv. Which of the following statements is/are TRUE for every such graph GG and tree TT?
More than one option can be correct.
Show answer without attempting

Answer: C

Q60

GATE CS 2024 CS-1Graph AlgorithmsNAT2 marks
The number of edges present in the forest generated by the DFS traversal of an undirected graph GG with 100 vertices is 40. The number of connected components in GG is _________
Show answer without attempting

Answer: 60

Q59

GATE CS 2024 CS-2Graph AlgorithmsNAT2 marks
The number of distinct minimum-weight spanning trees of the following graph is _________
Question figure
Show answer without attempting

Answer: 9

Q56

GATE CS 2023 CSGraph AlgorithmsNAT2 marks
Let U={1,2,3}U = \{1, 2, 3\}. Let 2U2^U denote the powerset of UU. Consider an undirected graph GG whose vertex set is 2U2^U. For any A,B∈2UA, B \in 2^U, (A,B)(A, B) is an edge in GG if and only if (i) A≠BA \neq B, and (ii) either A⊊BA \subsetneq B or B⊊AB \subsetneq A. For any vertex AA in GG, the set of all possible orderings in which the vertices of GG can be visited in a Breadth First Search (BFS) starting from AA is denoted by B(A)\mathcal{B}(A).

If ∅\emptyset denotes the empty set, then the cardinality of B(∅)\mathcal{B}(\emptyset) is ____________.
Show answer without attempting

Answer: 5040

Q49

GATE CS 2022 CSGraph AlgorithmsMSQ2 marks
Consider a simple undirected weighted graph GG, all of whose edge weights are distinct. Which of the following statements about the minimum spanning trees of GG is/are TRUE?
More than one option can be correct.
Show answer without attempting

Answer: A, B, C

Q17

GATE CS 2021 CS-1Graph AlgorithmsNAT1 mark
Consider the following undirected graph with edge weights as shown:
The number of minimum-weight spanning trees of the graph is ______.
Question figure
Show answer without attempting

Answer: 3

Q41

GATE CS 2021 CS-1Graph AlgorithmsMSQ2 marks
An articulation point in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components.
Let TT be a DFS tree obtained by doing DFS in a connected undirected graph GG.
Which of the following options is/are correct?
More than one option can be correct.
Show answer without attempting

Answer: B

Q1

GATE CS 2021 CS-2Graph AlgorithmsMCQ1 mark−1/3 if wrong
Let GG be a connected undirected weighted graph. Consider the following two statements.

S1S_1: There exists a minimum weight edge in GG which is present in every minimum spanning tree of GG.
S2S_2: If every edge in GG has distinct weight, then GG has a unique minimum spanning tree.

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

Answer: C

Q46

GATE CS 2021 CS-2Graph AlgorithmsMSQ2 marks
Consider the following directed graph:

Which of the following is/are correct about the graph?
Question figure
More than one option can be correct.
Show answer without attempting

Answer: A, B

0/200 correct0 marks

Related topics in Algorithms