Skip to content
Official PYQ · 2014

GATE CS 2014 Set 3 Q51 — Graphs: Connectivity, Matching, Colouring

Explain with AI

If GG is the forest with nn vertices and kk connected components, how many edges does GG have?

Choose one option
View worked solution

Answer: C

A forest is an acyclic graph where each connected component is a tree.

Let the forest GG have kk connected components, denoted by T1,T2,…,TkT_1, T_2, \dots, T_k. Let nin_i be the number of vertices in the component TiT_i for 1≤i≤k1 \le i \le k.

Since the components partition the vertex set of GG, the total number of vertices nn is:

∑i=1kni=n\sum_{i=1}^{k} n_i = n

Since each component TiT_i is a tree, the number of edges in TiT_i is ni−1n_i - 1. Therefore, the total number of edges ee in the forest GG is the sum of the edges in all components:

e=∑i=1k(ni−1)=∑i=1kni−∑i=1k1e = \sum_{i=1}^{k} (n_i - 1) = \sum_{i=1}^{k} n_i - \sum_{i=1}^{k} 1e=n−ke = n - k

Thus, the forest has n−kn - k edges.

Hence, the correct option is C.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Graphs: Connectivity, Matching, Colouring questions