Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Difference between Tree edge and Back edge in graph

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Tree Edge: It is an edge that is present in the tree obtained after performing DFS on the graph. All the Green edges are tree edges as shown in the below image. 

Back Edge: It is an edge (u, v) such that v is an ancestor of node u but not part of the DFS Traversal of the tree. Edge from 5 to 4 is a back edge. The presence of a back edge indicates a cycle in a directed graph.

Consider an undirected graph is given below, the DFS of the below graph is 3 1 2 4 6 5. In the below diagram, if the DFS is applied to this graph, a tree is obtained which is connected using green edges.

Tabular between the back Edge and tree Edge:

S.N.Tree EdgeBack Edge
1It connects the node to its descendants.It connects the node to its ancestors.
2It is the path traversed during DFS.It is the path not visited during DFS.
3They can form bridges.They can never form bridges.
4If it is disconnected, the number of connected components may increase.Even if it is disconnected, the number of connected components remains the same.
5It never creates a cycle.It can create a cycle.
My Personal Notes arrow_drop_up
Last Updated : 13 Jan, 2021
Like Article
Save Article
Similar Reads
Related Tutorials