Algorithms · Previous year questions
Graph Traversals, Topological Sort and Connectivity
24 questions from GATE CS 2012 to 2026, newest first.
Questions
GATE CS 2026 Set 1, Q.50
Consider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graph as input, where and are the discovery time and fini...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2026 Set 1, Q.55
An undirected, unweighted, simple graph is said to be 2-colorable if there exists a function such that for every …
Graph Traversals, Topological Sort and Connectivity
GATE CS 2025 Set 1, Q.43
Let be an undirected and unweighted graph with 100 vertices. Let denote the number of edges in a shortest path between vertices and in . Let the m...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2025 Set 2, Q.29
Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph is/are TRUE?
Graph Traversals, Topological Sort and Connectivity
GATE CS 2025 Set 2, Q.59
Consider the following algorithm
someAlgothat takes an undirected graph as input. someAlgo(G) 1. Let v be any vertex in G. Run BFS on G starting at v. Let u be a vertex i...Graph Traversals, Topological Sort and Connectivity
GATE CS 2024 Set 1, Q.45
Let be a directed graph and a depth first search (DFS) spanning tree in that is rooted at a vertex . Suppose is also a breadth first search (BFS) tree in ,...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2024 Set 1, Q.60
The number of edges present in the forest generated by the DFS traversal of an undirected graph with 100 vertices is 40. The number of connected components in is _________
Graph Traversals, Topological Sort and Connectivity
GATE CS 2023, Q.56
Let . Let denote the powerset of . Consider an undirected graph whose vertex set is . For any , is an edge in if an...
Graph Theory · Graph Traversals, Topological Sort and Connectivity
GATE CS 2021 Set 1, Q.51 (CS Q.41)
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 ...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2021 Set 2, Q.56 (CS Q.46)
Consider the following directed graph: A 4 by 4 directed grid graph with 16 solid black vertices and directed edges between adjacent vertices. The bottom-left vertex is labeled...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2020, Q.41 (CS Q.31)
Let be a weighted undirected graph and let be a Minimum Spanning Tree (MST) of maintained using adjacency lists. Suppose a new weighted edge…
Greedy Algorithms · Graph Traversals, Topological Sort and Connectivity
GATE CS 2020, Q.50 (CS Q.40)
Let be a directed, weighted graph with weight function . For some function , for each edge , define…
Graph Traversals, Topological Sort and Connectivity
GATE CS 2020, Q.59 (CS Q.49)
Consider a graph , where , , and weight of the edge is . The wei...
Greedy Algorithms · Graph Traversals, Topological Sort and Connectivity
GATE CS 2018, Q.40 (CS Q.30)
Let be a simple undirected graph. Let be a depth first search tree of . Let be a breadth first search tree of . Consider the following statements. (I) No e...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2017 Set 2, Q.15 (CS Q.15)
The Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which one of the following is a possible order of visiting the nodes in the graph b...
Graph Traversals, Topological Sort and Connectivity · Graph Representations and Disjoint Sets
GATE CS 2016 Set 1, Q.21 (CS Q.11)
Consider the following directed graph: Directed acyclic graph with six vertices labeled a, b, c, d, e, and f. Directed edges are from a to b, a to d, b to c, d to e, c to f, and...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2016 Set 2, Q.21 (CS Q.11)
Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex at a distance four from the root. If is the -th vertex in thi...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2015 Set 1, Q.55 (CS Q.45)
Let be a simple undirected graph, and be a particular vertex in it called the source. For , let denote the shortest distance in from to...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 1, Q.13 (CS Q.3)
Let be a directed graph where is the set of vertices and the set of edges. Then which one of the following graphs has the same strongly connected components as...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 1, Q.21 (CS Q.11)
Let be a graph with vertices and edges. What is the tightest upper bound on the running time of Depth First Search on , when is represented as an adjacency ma...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 1, Q.23 (CS Q.13)
Consider the directed graph given below. Directed graph on four vertices P, Q, R, and S Which one of the following is TRUE?
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 2, Q.24 (CS Q.14)
Consider the tree arcs of a BFS traversal from a source node in an unweighted, connected, undirected graph. The tree formed by the tree arcs is a data structure for comp...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 3, Q.23 (CS Q.13)
Suppose depth first search is executed on the graph below starting at some unknown vertex. Assume that a recursive call to visit a vertex is made only after first checking that...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2012, Q.29 (CS Q.29)
Let be a weighted graph with edge weights greater than one and be the graph constructed by squaring the weights of edges in . Let and be the minimum spannin...
Greedy Algorithms · Graph Traversals, Topological Sort and Connectivity