closed by
1,512 views
1 votes
1 votes
closed with the note: Conflicting question w.r.t conditions mentioned in the question..Hence not nicely framed question

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 ______________

closed by

1 Answer

0 votes
0 votes

Definition of Back edge :- If v is an ancestor of u, then edge (u, v) is a back edge.

ref :- https://courses.csail.mit.edu/6.006/fall11/rec/rec14.pdf

Now, starting from point p next unvisited nodes {q,r,s} choosing based on alphabetical order. i.e. q

standing at node q next unvisited nodes { r, t} choosing based on alphabetical order. i.e. r

standing at node next unvisited nodes { v} choosing based on alphabetical order. i.e. v

standing at node next unvisited nodes { s, t} choosing based on alphabetical order. i.e. s

standing at node next unvisited nodes {  t} choosing based on alphabetical order. i.e. t

All nodes are traversed, 

Back edges are as follow :- (t,v), (s,p) , (t,q) (r,p)

Number of back edges = 4.

Hence 4 is the answer.

Related questions

1 votes
1 votes
1 answer
2
0 votes
0 votes
0 answers
4
saumya mishra asked Sep 25, 2017
290 views
What is the correct answer please provide with reason?