in Graph Theory edited by
18,276 views
57 votes
57 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$
in Graph Theory edited by
18.3k views

4 Comments

The best answer is a bit misleading. 

First let's see the definitions. 

 

Tree: acyclic, connected and undirected graph.

Forest: collection of 1 or more trees .

Rooted tree: it's a special type of directed acyclic graphs. It has a root node from which there exist unique path to every other vertex. 

The authors says that every tree has a root node which is not a correct statement. 

Concepts like height, root node, depth, children, parents, ancestors etc are for Rooted tree and not tree. A tree is simply a connected , acyclic undirected graph. 

The comment under the best answer by @Vicky rix is a good answer for this question. 

0
0

here is a slight variation of the same question :

calculate no of distinct forests possible with n vertices and k components 

can be solved with star-bar problem:

consider every component as a box 

first fill every box with minimum 1 vertex –> so k components with 1 vertex each

remaining n-k vertices can be distributed in k components in $\binom{n-k+k-1}{n-k} = \binom{n-1}{n-k}$ ways.

So, $\binom{n-1}{n-k}$ forests possible with n vertices and k components.

1
1

11 Answers

67 votes
67 votes
Best answer

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

4 Comments

Have a doubt..How is it k "connected " components."Connected " implies it is not a forest itself as a forest has disjoint collection of trees.Please anybody explain.
0
0

yes, answer by is the best one !:)

0
0

very well explained @Vicky rix

0
0
34 votes
34 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$

28 votes
28 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
8 votes
8 votes
Please verify this method
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true