462 views
0 votes
0 votes
Can we use DFS to detect the negetive weight cycle in a directed graph?

1 Answer

0 votes
0 votes
Yes Possible.

If there is a Back Edge (u,v) in a DFT , there is a cycle in the graph G.

Total Cost from v to u + Back Edge Cost(u,v) <0 indicates there is a negative weighted cycle in the graph G.

Related questions

5 votes
5 votes
1 answer
4
manvi_agarwal asked Sep 15, 2018
2,491 views
Also let me know the approach to find back edges, cross edges, forward edges,How to solve these questions