• edited by
31,679 views
77 77 votes

If $G$ is the forest with $n$ vertices and $k$ connected components, how many edges does $G$ have?

  1. $\left\lfloor\frac {n}{k}\right\rfloor$
  2. $\left\lceil \frac{n}{k} \right\rceil$
  3. $n-k$
  4. $n-k+1$

15 Answers

Best answer
87 87 votes

A forest is a collection of trees. here we are given a forest with $n$ vertices and $k$ components. a component is itself a tree.

Since there are $k$ components means that every component has a root (every tree has one), therefore we have $k$ roots.

Introduction of each new vertex to the forest introduces a single edge to a forest. so for remaining $n-k$ vertices when introduced, to make up to $n$ vertices, contributes to $n-k$ edges.

Hence, ans $=$ option (C) $= (n-k)$

• edited by
46 46 votes

Another way:

If $1$ edge is removed $2$ components.

If $2$ edges removed $3$ components.

.

.

.

If $k-1$ edges removed $k$ components.

A tree has $n-1$ edges. So, to make that tree into forest with $k$ components we would remove $k-1$ edges.

Therefore, Total edges in forest (Edges remained) = $n-1-(k-1)=n-k$

29 29 votes

A forest is an acyclic graph(with no cycle) , i.e all these components are a tree. With k components there are k roots.

And whenever a new node is added to a tree only a singe edge is introduced.
With k roots , remaining nodes are (n-k) each of which introduces an edge.

Hence, there are $\left(n-k\right)\times 1=\left(n-k\right)$ edges.

• edited by
2 2 votes
Since a forest with n vertices can not have more than n-1 edges with no cycle. By keeping this definition in mind, draw some graphs such as

n = 4 components(k)=2 then e=2

n = 5 , k = 3 then e= 2

n = 4 k = 3 then e = 1  

and so all are satisfying than e = n - k
Answer:
Position:
Show:

Related questions

9 9 votes
5 answers 5 answers
8.9k
8.9k views
go_editor asked Sep 28, 2014
8,926 views
In the context of modular software design, which one of the following combinations is desirable?High cohesion and high couplingHigh cohesion and low couplingLow cohesion ...
39 39 votes
3 answers 3 answers
14.0k
14.0k views
go_editor asked Sep 28, 2014
13,998 views
Let $\delta$ denote the minimum degree of a vertex in a graph. For all planar graphs on $n$ vertices with $\delta \geq 3$, which one of the following is TRUE?In any plana...
146 146 votes
17 answers 17 answers
40.6k
40.6k views
go_editor asked Sep 28, 2014
40,619 views
Consider an undirected graph $G$ where self-loops are not allowed. The vertex set of $G$ is $\{(i,j) \mid1 \leq i \leq 12, 1 \leq j \leq 12\}$. There is an edge between $...
51 51 votes
10 answers 10 answers
35.2k
35.2k views
go_editor asked Sep 28, 2014
35,208 views
The maximum number of edges in a bipartite graph on $12$ vertices is____