GateAI
Graph Theory

GATE CSE 2024 Set 1 · Q60

NAT2 marksEasy

Time

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 ________

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 60

Graph Theory

A DFS traversal on an undirected graph with nn vertices and kk connected components produces a DFS spanning forest consisting of kk trees.

Let the ii-th connected component have nin_i vertices. The DFS tree spanning this component has ni−1n_i - 1 edges.

The total number of edges EFE_F in the DFS forest is the sum of edges across all kk trees:

EF=∑i=1k(ni−1)=∑i=1kni−∑i=1k1=n−kE_F = \sum_{i=1}^{k} (n_i - 1) = \sum_{i=1}^{k} n_i - \sum_{i=1}^{k} 1 = n - k

Given n=100n = 100 and EF=40E_F = 40:

40=100−k  ⟹  k=100−40=6040 = 100 - k \implies k = 100 - 40 = 60

Therefore, the number of connected components in GG is 60.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Graph Theory previous year question is Q60 of the GATE CSE 2024 Set 1 paper. Find more GATE CSE PYQs on Graph Theory in Engineering Mathematics, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Graph Theory PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Graph Theory in GATE CSE

Graph Theory has 21 GATE CSE PYQs across 14 papers from 2012 to 2026. 7 of them are 2-mark NAT questions like this one, and GATE CSE 2024 Set 1 has 3.

How GATE tests Graph Theory

More from GATE CSE 2024 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2024 Set 1 · Q60 · NAT

The number of edges present in the forest generated by the DFS traversal of an undirected graph G with 100 vertices is 40. The number of connected components in G is …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.