GATE / CS ARCHIVE

SIMILAR QUESTIONS / DISCRETE MATHEMATICS

Use forest edges equals vertices minus components

2 questions solved the same way, newest first. Back to Discrete Mathematics

2 marks · MCQ
Report issue

Asked again GATE 1992, Q3(iii) (same question)

Trees & Connectivity

Question 51, GATE 2014: A forest G has n vertices and k connected components. How many edges does it contain? A floor(n/k); B ceil(n/k); C n−k; D n−k+1.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step 1: Each connected component of a forest is a tree. A tree with vi vertices contains vi−1 edges, including a one-vertex component with zero edges. Step 2: Sum across the k components: E=Σ(vi−1)=Σvi−k=n−k. Step 3: Thus C is correct. The quotient n/k concerns an average component size, not the total edge count; the extra +1 in D would already fail for a single tree.

Original paper, page 65 · Answer key

Descriptive
Report issue

Asked again GATE 2014 Set 3, Q51 (same question)

Edges in a forest

Trees & Connectivity

Question 3(iii), GATE 1992: A forest has n vertices and p connected components. How many edges?
Question 3(iii), GATE 1992: A forest has n vertices and p connected components. How many edges?
Tap to enlarge
Answer & solution

Answer: n−p (no official key was published)

Every component of a forest is a tree. If component i has ni vertices, it has ni−1 edges. Summing over the p components gives Σ(ni−1)=Σni−p=n−p. Isolated vertices count as one-vertex components with zero edges, so the formula handles them automatically. The acyclicity assumption is essential: a graph with cycles can have more edges with the same n and p. The empty forest gives zero with n=p=0.

Original paper, page 5