Question
If is a forest with vertices and connected components, how many edges does have?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2014 answer key
Solution
Sum the edge counts across all connected components of an acyclic graph.
-
A forest is defined as an undirected acyclic graph.
-
Each connected component of a forest is a tree.
-
Let be the number of connected components, and let denote the number of vertices in component for .
- The sum of vertices over all components is:
- The sum of vertices over all components is:
-
For any tree with vertices, the number of edges is exactly .
-
Summing edges across all trees:
This matches option C ().
C
Using the tree formula n - 1 instead of subtracting k for a forest with k components.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2014 Computer Science and Information Technology (CS) Session 3
- Question
- 61 of 65, printed as CS Q.51
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.