• edited by
20,626 views
43 43 votes

Consider the depth-first-search of an undirected graph with $3$ vertices $P$, $Q$, and $R$. Let discovery time $d(u)$ represent the time instant when the vertex $u$ is first visited, and finish time $f(u)$ represent the time instant when the vertex $u$ is last visited. Given that

$$\begin{array}{|ll|ll|}\hline & \text{$d(P) = 5$ units }  &  \text{ $f(P) = 12$ units  } \\\hline &  \text{$d(Q) = 6$ units} & \text{ $f(Q) = 10$ units} \\\hline & \text{$d(R) = 14$ unit} & \text{ $f(R) = 18$ units}  \\\hline \end{array}$$
Which one of the following statements is TRUE about the graph?

  1. There is only one connected component
  2. There are two connected components, and $P$ and $R$ are connected
  3. There are two connected components, and $Q$ and $R$ are connected
  4. There are two connected components, and $P$ and $Q$ are connected

9 Answers

Best answer
52 52 votes

As seen in question, after $10$ we have to go for $p$ again and since $p$ is finished and then $r$ is started it means $r$ must be disconnected. If there is an edge from $q$ to $r$ then $r$ must be visited before $q$ and $p$ end. 

D is answer.

• edited by
10 10 votes

After knowing the statement of Parenthesis Theorem, the solution is straightforward.

Given that discovery time and finish time of the vertices are as follows:

P = [5, 12]

Q= [6, 10]

R= [14, 18]

Here,

the interval of Q is contained entirely within the interval of P

  ⇒ Q is a descendant of P in a DFS tree (i.e. P and Q belong to the same DFS tree)

Again,

the interval of R and P are entirely disjoint

 ⇒ Neither R nor P is a descendant of the other

 ⇒ R and P are in different DFS trees (i.e. R and P belong to different DFS trees)

Hence, option D is correct. (Refer the image attached)

Further, all other similar questions can also be easily solved with this Theorem.

• edited by
9 9 votes
since d(q)=d(p)+1 and f(q)< f(p) which means p and q are connected
and r is seperate so d is the answer
5 5 votes

Arrange all the discovery time and Finish time in Increasing Order

$   i.e    D[P]<=D[Q]<=F[Q]<=F[P]<=D[R]<=F[R]$

Now make a Graph Accordingly.

Answer:
Position:
Show:

Related questions

32 32 votes
4 answers 4 answers
12.7k
12.7k views
Ishrat Jahan asked Oct 28, 2014
12,677 views
Consider the following sequence of nodes for the undirected graph given below:$a$ $b$ $e$ $f$ $d$ $g$ $c$$a$ $b$ $e$ $f$ $c$ $g$ $d$$a$ $d$ $g$ $e$ $b$ $c$ $f$$a$ $d$ $b$...
81 81 votes
11 answers 11 answers
23.9k
23.9k views
Ishrat Jahan asked Oct 29, 2014
23,944 views
A depth-first search is performed on a directed acyclic graph. Let $d[u]$ denote the time at which vertex $u$ is visited for the first time and $f[u]$ the time at which t...
20 20 votes
4 answers 4 answers
8.5k
8.5k views
Misbah Ghaya asked Nov 30, 2016
8,520 views
In the graph shown above, the depth-first spanning tree edges are marked with a $’ T’$. Identify the forward, backward, and cross edges.
50 50 votes
6 answers 6 answers
19.6k
19.6k views
Ishrat Jahan asked Oct 31, 2014
19,584 views
Which of the following is the correct decomposition of the directed graph given below into its strongly connected components?$\left \{ P, Q, R, S \right \}, \left \{ T \...