In a directed graph, if you find scc (strongly connected components), then for each negative edge, if its 2 vertices are in the same scc and that scc has size > 1, then there is a negative cycle with that edge, and is easy to find it with a simple dfs. Is this approach correct?
1 Answer
$\begingroup$
$\endgroup$
1
No it's not true. Consider a graph with two nodes, A and B, with an edge A->B with length 1 and an edge B->A with length -1.
The edge B->A is a negative edge and its vertices are in the same SCC and that SCC has size > 1. That edge is not part of a negative cycle.