• retagged by
2,393 views
6 6 votes
Which of the following is false?

1)An edge(u,v) is forward edge if and only if

d[u] < =d[v] <= f[v] <= f[u].

2) an edge (u,v) is a cross edge if and only if

d[u] < f[u] < d[v] < f[v].

3) an edge (u,v) is a back edge if and only if

d[v] < d[u] < f[u] < f[v].

1 Answer

11 11 votes

Tree edge :- is an edge of our DFS tree

Forward edge(u->v) :- An edge which is not part of our DFS tree and here vertex 'v' is descendant of vertex 'u' , both vertices are part of DFS tree. or in simple words , edge that is coming forward in tree but not part of our DFS tree if it's part of our DFS tree then it becomes Tree edge.

in our figure AD is forward edge(here u=A and v=D)during DFS traversal first A is discovered and then D is discovered and then during backtracking first we are done with D and then A

so d[A]<d[D]<f[D]<f[A]

Back edge (u->v) :- An edge which is  not part of our DFS tree and here vertex 'v' is ancestor  to vertex 'u'. Both vertices are part of our DFS tree. or in simple words , edge that is going back to our DFS tree.

here in our figure DA is back edge , suppose there is also an edge from C->A then it's also back edge. so here u=D and v=A. first we will visit A then reach D and then during backtracking will finish D first and then A later. so d[A]<d[D]<f[D]<f[A]

Cross Edge (u->v) :-All other remaining edges are cross edges. those are also not part of our DFS tree. No ancestor relationship b/w 'u' and 'v'. both vertices may belong to our DFS tree or they may belongs to different trees.

in our figure D->C is cross edge , here u=D and v=C , first we visited C and then finish with C and then we reach D and then finish with D also so d[C]<f[C]<d[D]<f[D].

Resources :

https://www.youtube.com/watch?v=Lw5rRctO9js&index=29&list=PLBF3763AF2E1C572F

http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/GraphAlgor/depthSearch.htm

Position:
Show:

Related questions

3 3 votes
1 1 answer
2.7k
2.7k views
Rishav Kumar Singh asked Jul 30, 2018
2,675 views
Is following statement true/false? A DFS of a directed graph always produces the same number of tree edges, i.e., independent of the order in which vertices are considere...
2 2 votes
0 0 answers
604
604 views
LRU asked Nov 18, 2021
604 views
A tree with n nodes and the property that the heights of the two children of any node differ by at most 2 has O(log n) height.Please explain this statement to be true or ...
0 0 votes
0 0 answers
489
489 views
eyeamgj asked Nov 30, 2018
489 views
https://gateoverflow.in/132037/self-doubt-in-binary-search-algoDOUBT : THIS QUESTION 10 ELEMENTS ARE IN ARRAY AND SORTED THEN HOW CAN WE DRAW A BALANCED TREE BECZ IT I...