Unit 6: Graphs - Subjective Questions

CSE205 — Data Structures And Algorithms • Practice Questions with Detailed Answers

20 questions

1

Define a graph. Explain the major terms associated with graphs, including vertex, edge, degree, path, cycle, and connected component.

2

Compare adjacency matrix and adjacency list representations of a graph.

3

What is graph traversal? Explain why a visited array or set is required during traversal.

4

Describe the Breadth-First Search algorithm with pseudocode and analyze its time and space complexity.

5

Explain how BFS finds the shortest path in an unweighted graph. How can the actual path be reconstructed?

6

Describe the Depth-First Search algorithm using both recursive and iterative approaches. Analyze its complexity.

7

Distinguish between Breadth-First Search and Depth-First Search.

8

Explain how DFS can be used to detect cycles in directed and undirected graphs.

9

Describe how graph traversal can identify all connected components of an undirected graph.

10

Define the single-source shortest-path problem and explain the edge relaxation operation used by shortest-path algorithms.

11

Explain Dijkstra's algorithm with pseudocode, its correctness condition, and complexity analysis.

12

Trace Dijkstra's algorithm on a graph with edges , , , , , and . Determine the shortest distances and paths from .

13

Why does Dijkstra's algorithm fail on graphs containing negative-weight edges? Explain with an example.

14

Describe the Bellman-Ford algorithm. Explain why it performs relaxation passes and how it detects a reachable negative-weight cycle.

15

Trace Bellman-Ford on the directed graph with edges , , , , and . Give the final shortest distances from .

16

Compare Dijkstra's algorithm and the Bellman-Ford algorithm.

17

Explain the Floyd-Warshall algorithm and derive its dynamic programming recurrence.

18

Apply Floyd-Warshall to the initial distance matrix and determine the final all-pairs shortest-path matrix.

19

How does Floyd-Warshall detect negative-weight cycles, and how do such cycles affect shortest paths?

20

Compare BFS, Dijkstra, Bellman-Ford, and Floyd-Warshall as shortest-path algorithms, and state when each should be used.