in Programming in C
1,077 views
0 votes
0 votes

Consider the following graph G.

Modified DFS on G applied as follows:
• Starting vertex is ‘p’.
• Vertex is visited based on alphabetic order.
• Vertices are visited in order p, q, r, s, t, v.
• It works same as DFS except the visiting order restriction

What is the number of back edges during the above DFS traversal on G?

a. 2

b. 3

c. 4

d. 5

Explain...how??

in Programming in C
1.1k views

4 Comments

I think when we have choices than we need to give priority in this order (p,q,r,s,t,v). Means from P we have 3 choices either Q, R and S and we need to choose Q according to order. From Q, we have again 2 choices R and T. R should be given more priority. From R we have only one choice V(as P is already visited). So we should choose V. Similarly from V we have 2 choices either T or S and we should give priority to S first. From S to T.

Tree edges. (P, Q), (Q, R), (R, V), (V, S), (S, T).
3
3
Yes correct and remaining back edges.
0
0
Thank you Sir.
1
1

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
1
Na462 asked in Programming in C Nov 7, 2018
1,006 views
Na462 asked in Programming in C Nov 7, 2018
by Na462
1.0k views
1 vote
1 vote
0 answers
2
Aditya Bahuguna asked in Programming in C Jan 3, 2018
299 views
Aditya Bahuguna asked in Programming in C Jan 3, 2018
299 views
1 vote
1 vote
2 answers
4