GATE CS 2024 Set 1 — Question 60
NAT+2 / -0EasyDFS TraversalGraphs (Data Structure)Programming & Data StructuresConnected Components
Programming & Data Structures → Graphs (Data Structure) → Connected Components
Last updated
Question
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 _________
Correct answer
60 to 60
Solution
In an undirected graph with vertices and connected components, any spanning forest (including one generated by DFS) will have exactly edges.Given:
Using the formula for the number of edges in a forest:Therefore, the number of connected components in is 60.
- Number of vertices () = 100
- Number of edges in the DFS forest = 40
Using the formula for the number of edges in a forest:Therefore, the number of connected components in is 60.
More questions on Graphs (Data Structure)
2024 Set 2 Q13Consider the following C program. Assume parameters to a function are evaluated from right to left.…2024 Set 2 Q17Let be the adjacency matrix of a simple undirected graph . Suppose is its own inverse.…2024 Set 1 Q17Given an integer array of size , we want to check if the array is sorted (in either ascending or…2024 Set 1 Q18Consider the following C program: [code] Which one of the following statements is CORRECT?2024 Set 1 Q19Consider the following C program: [code] Assume that the input to the program from the command line…
Practice GATE CS PYQs with adaptive difficulty
Timed practice, skill tracking, and AI explanations — free to start.
Start practicing free