Design and Analysis of Algorithms
106502Module 3: Graph and Tree Algorithms
Q1a. An adjacency matrix representation of a graph cannot contain information of (i) nodes (ii) edges (iii) direction of edges (iv) parallel edges20222m
Module 3: Graph and Tree Algorithms
View this question on its own page →An adjacency matrix representation of a graph cannot contain information of
(i) nodes
(ii) edges
(iii) direction of edges
(iv) parallel edgesQ1c. The minimum number of colors needed to color a graph having n > 3 vertices and 2 edges is (i) 2 (ii) 3 (iii) 4 (iv) 120222m
Module 3: Graph and Tree Algorithms
View this question on its own page →The minimum number of colors needed to color a graph having vertices and 2 edges is
(i) 2
(ii) 3
(iii) 4
(iv) 1Q1c. Which of the following algorithms is used to find the minimum spanning tree in a weighted undirected graph? (i) Dijkstra's algorithm (ii) Kruskal's algorithm (iii) Bellman-Ford algorithm (iv) Floyd-Warshall algorithm20232m
Module 3: Graph and Tree Algorithms
View this question on its own page →Which of the following algorithms is used to find the minimum spanning tree in a weighted undirected graph?
(i) Dijkstra's algorithm
(ii) Kruskal's algorithm
(iii) Bellman-Ford algorithm
(iv) Floyd-Warshall algorithmQ1d. BFS on a graph G = (V, E) has running time (i) O(|V| + |E|) (ii) O(|V|) (iii) O(|E|) (iv) None of these20222m
Module 3: Graph and Tree Algorithms
View this question on its own page →BFS on a graph has running time
(i)
(ii)
(iii)
(iv) None of theseQ1e. In DFS traversal of a graph, which data structure is used to keep track of visited nodes? (i) Queue (ii) Stack (iii) Priority Queue (iv) Heap20242m
Module 3: Graph and Tree Algorithms
View this question on its own page →In DFS traversal of a graph, which data structure is used to keep track of visited nodes?
(i) Queue
(ii) Stack
(iii) Priority Queue
(iv) HeapQ1e. In an unweighted graph, which algorithm is guaranteed to find the shortest path between two nodes? (i) Depth First Search (ii) Kruskal's Algorithm (iii) Breadth First Search (iv) Prim's Algorithm20252m
Module 3: Graph and Tree Algorithms
View this question on its own page →In an unweighted graph, which algorithm is guaranteed to find the shortest path between two nodes?
(i) Depth First Search
(ii) Kruskal's Algorithm
(iii) Breadth First Search
(iv) Prim's AlgorithmQ1f. Which algorithm is used to find a Minimum Spanning Tree? (i) Dijkstra's algorithm (ii) Prim's algorithm (iii) Bellman-Ford algorithm (iv) Floyd-Warshall algorithm20242m
Module 3: Graph and Tree Algorithms
View this question on its own page →Which algorithm is used to find a Minimum Spanning Tree?
(i) Dijkstra's algorithm
(ii) Prim's algorithm
(iii) Bellman-Ford algorithm
(iv) Floyd-Warshall algorithmQ1f. Which of the following algorithms is commonly used to find the Minimum Spanning Tree of a graph? (i) Dijkstra's Algorithm (ii) Kruskal's Algorithm (iii) Bellman-Ford Algorithm (iv) Floyd-Warshall Algorithm20252m
Module 3: Graph and Tree Algorithms
View this question on its own page →Which of the following algorithms is commonly used to find the Minimum Spanning Tree of a graph?
(i) Dijkstra's Algorithm
(ii) Kruskal's Algorithm
(iii) Bellman-Ford Algorithm
(iv) Floyd-Warshall AlgorithmQ1g. Which of the following algorithm solves the All Pair Shortest Path problem (i) Dijkstra's (ii) Floyd's Warshall's (iii) Prim's (iv) Kruskal's20222m
Module 3: Graph and Tree Algorithms
View this question on its own page →Which of the following algorithm solves the All Pair Shortest Path problem
(i) Dijkstra's
(ii) Floyd's Warshall's
(iii) Prim's
(iv) Kruskal'sQ1g. Topological sorting is only possible in: (i) Undirected Graphs (ii) Trees (iii) Directed Acyclic Graphs (iv) Weighted Graphs20242m
Module 3: Graph and Tree Algorithms
View this question on its own page →Topological sorting is only possible in:
(i) Undirected Graphs
(ii) Trees
(iii) Directed Acyclic Graphs
(iv) Weighted GraphsQ1g. If all edge weights in a graph are positive, what is the minimum number of edges in a spanning tree for a graph with vertices? (i) V (ii) V-1 (iii) V+1 (iv) 2V20252m
Module 3: Graph and Tree Algorithms
View this question on its own page →If all edge weights in a graph are positive, what is the minimum number of edges in a spanning tree for a graph with vertices?
(i) V
(ii) V-1
(iii) V+1
(iv) 2VQ1h. Which algorithm is typically used in maximum flow problems? (i) Kruskal's Algorithm (ii) Floyd-Warshall (iii) Ford-Fulkerson (iv) Prim's Algorithm20242m
Module 3: Graph and Tree Algorithms
View this question on its own page →Which algorithm is typically used in maximum flow problems?
(i) Kruskal's Algorithm
(ii) Floyd-Warshall
(iii) Ford-Fulkerson
(iv) Prim's AlgorithmQ1i. What is the time complexity of topological sorting of a directed acyclic graph (DAG) with V vertices and E edges using Depth-First Search (DFS)? (i) O(V^2) (ii) O(E^2) (iii) O(V+E) (iv) O(V.E)20232m
Module 3: Graph and Tree Algorithms
View this question on its own page →What is the time complexity of topological sorting of a directed acyclic graph (DAG) with vertices and edges using Depth-First Search (DFS)?
(i)
(ii)
(iii)
(iv)Q3a. Give step by step procedure to find minimal spanning tree for the given graph. 20227m
Module 3: Graph and Tree Algorithms
View this question on its own page →Give step by step procedure to find minimal spanning tree for the given graph.
Q3b. What is a Minimum Cost Spanning tree? Explain Kruskal's Minimum cost spanning tree algorithm with a suitable example.20257m
Module 3: Graph and Tree Algorithms
View this question on its own page →What is a Minimum Cost Spanning tree? Explain Kruskal's Minimum cost spanning tree algorithm with a suitable example.
Q4a. Solve the single source shortest path problem for the following graph considering '1' as the source vertex using Dijkstra's algorithm. 20227m
Module 3: Graph and Tree Algorithms
View this question on its own page →Solve the single source shortest path problem for the following graph considering '1' as the source vertex using Dijkstra's algorithm.
Q5a. Answer the following: (i) Compare and contrast the BFS and DFS traversal techniques in terms of their algorithmic approach, time complexity, data structures used, and typical applications. (ii) Give examples where one is preferred over the other.20247m
Module 3: Graph and Tree Algorithms
View this question on its own page →Answer the following:
(i) Compare and contrast the BFS and DFS traversal techniques in terms of their algorithmic approach, time complexity, data structures used, and typical applications.
(ii) Give examples where one is preferred over the other.Q5a. Explain BFS algorithm in detail. Also explain its time complexity.20257m
Module 3: Graph and Tree Algorithms
View this question on its own page →Explain BFS algorithm in detail. Also explain its time complexity.
Q5b. Design a system that finds the shortest paths between various locations in a city. The locations and roads are represented using a graph. What algorithm would you use if: (i) All roads have equal length (ii) Roads have varying lengths, but no negative lengths (iii) Some roads have negative lengths Justify your choices with suitable algorithms and reasoning.20247m
Module 3: Graph and Tree Algorithms
View this question on its own page →Design a system that finds the shortest paths between various locations in a city. The locations and roads are represented using a graph. What algorithm would you use if:
(i) All roads have equal length
(ii) Roads have varying lengths, but no negative lengths
(iii) Some roads have negative lengths
Justify your choices with suitable algorithms and reasoning.Q5b. Explain how Bellman Ford algorithm can be used to detect the presence of negative weight cycles.20257m
Module 3: Graph and Tree Algorithms
View this question on its own page →Explain how Bellman Ford algorithm can be used to detect the presence of negative weight cycles.
Q6a. In the below given weighted graph W (Given in form of matrix), apply Bellman Ford's algorithm to find the shortest distances from source node 3. Write the time complexity of Bellman Ford's algorithm. | | 1 | 2 | 3 | 4 | 5 | |---|---|---|---|---|---| | 1 | 0 | 1 | 8 | 1 | 4 | | 2 | 1 | 0 | 12 | 4 | 9 | | 3 | 8 | 12 | 0 | 7 | 3 | | 4 | 1 | 4 | 7 | 0 | 2 | | 5 | 4 | 9 | 3 | 2 | 0 |20237m
Module 3: Graph and Tree Algorithms
View this question on its own page →In the below given weighted graph W (Given in form of matrix), apply Bellman Ford's algorithm to find the shortest distances from source node 3. Write the time complexity of Bellman Ford's algorithm.
1 2 3 4 5 1 0 1 8 1 4 2 1 0 12 4 9 3 8 12 0 7 3 4 1 4 7 0 2 5 4 9 3 2 0 Q6a. A graph with five nodes is represented using the adjacency list as follows: | | | | | | |---|---|---|---|---| | A | -> | B (10) | C (3) | | | B | -> | C (1) | D (5) | | | C | -> | B (4) | D (8) | E (2) | | D | -> | E (7) | | | | E | -> | D (9) | | | Answer the following: (i) Draw the graph for the above adjacency list. (ii) Write the algorithm for the Breadth-First Traversal (BFS). (iii) Show the BFS traversal of the graph with the starting node as A.20247m
Module 3: Graph and Tree Algorithms
View this question on its own page →A graph with five nodes is represented using the adjacency list as follows:
A -> B (10) C (3) B -> C (1) D (5) C -> B (4) D (8) E (2) D -> E (7) E -> D (9) Answer the following:
(i) Draw the graph for the above adjacency list.
(ii) Write the algorithm for the Breadth-First Traversal (BFS).
(iii) Show the BFS traversal of the graph with the starting node as A.Q6a. Explain the Prim's algorithm. What is the time complexity of Prim's algorithm?20257m
Module 3: Graph and Tree Algorithms
View this question on its own page →Explain the Prim's algorithm. What is the time complexity of Prim's algorithm?
Q6b. What is minimum spanning tree (MST)? Explain the steps of Prim's algorithm to find the MST using an example.20237m
Module 3: Graph and Tree Algorithms
View this question on its own page →What is minimum spanning tree (MST)? Explain the steps of Prim's algorithm to find the MST using an example.
Q6b. Write the Pseudo-code for the Dijkstra's Algorithm. Further, find the single source (A) shortest path on the following graph: 20247m
Module 3: Graph and Tree Algorithms
View this question on its own page →Write the Pseudo-code for the Dijkstra's Algorithm. Further, find the single source (A) shortest path on the following graph:
Q6b. Apply the Prim's algorithm and find the optimal solution for the following graph: 20257m
Module 3: Graph and Tree Algorithms
View this question on its own page →Apply the Prim's algorithm and find the optimal solution for the following graph:

Q7a. What is negative weight-cycle? Write Bellman-Ford algorithm to find single source shortest distance of a directed graph.20227m
Module 3: Graph and Tree Algorithms
View this question on its own page →What is negative weight-cycle? Write Bellman-Ford algorithm to find single source shortest distance of a directed graph.
Q7a. Discuss the differences between BFS and DFS in terms of traversal order, memory usage, and their applications in real-world problems.20237m
Module 3: Graph and Tree Algorithms
View this question on its own page →Discuss the differences between BFS and DFS in terms of traversal order, memory usage, and their applications in real-world problems.
Q7a. Answer the following: (i) Explain the concept of a Minimum Spanning Tree (MST) in a connected, weighted, undirected graph. (ii) Compare and contrast Prim's and Kruskal's algorithms for finding the MST. (iii) Analyze the time complexity of both algorithms and discuss their advantages and scenarios where one is preferred over the other.20247m
Module 3: Graph and Tree Algorithms
View this question on its own page →Answer the following:
(i) Explain the concept of a Minimum Spanning Tree (MST) in a connected, weighted, undirected graph.
(ii) Compare and contrast Prim's and Kruskal's algorithms for finding the MST.
(iii) Analyze the time complexity of both algorithms and discuss their advantages and scenarios where one is preferred over the other.Q7b. Given the flow network below with capacities: | EDGE | CAPACITY | |---|---| | S -> A | 10 | | S -> C | 10 | | A -> B | 4 | | A -> C | 2 | | C -> D | 9 | | B -> T | 10 | | D -> B | 6 | | D -> T | 10 | Answer the following: (i) Use the Ford-Fulkerson algorithm to find the maximum flow from source (S) to sink (T). (ii) Show the augmenting paths selected, the bottleneck capacities on each path, and the updated residual capacities after each augmentation. (iii) Calculate the final maximum flow value.20247m
Module 3: Graph and Tree Algorithms
View this question on its own page →Given the flow network below with capacities:
EDGE CAPACITY S -> A 10 S -> C 10 A -> B 4 A -> C 2 C -> D 9 B -> T 10 D -> B 6 D -> T 10 Answer the following:
(i) Use the Ford-Fulkerson algorithm to find the maximum flow from source (S) to sink (T).
(ii) Show the augmenting paths selected, the bottleneck capacities on each path, and the updated residual capacities after each augmentation.
(iii) Calculate the final maximum flow value.