I found the algorithm for finding the negative cycle in a graph after running Bellman-Ford algorithm.

The algorithm is to perform another relax iteration over all the edges. Than if we find an edge to relax we stop and start to follow it parent vertex starting from $V$ that $u$ is its parent until we close a cycle.

I'm having little problem proving this. I want to prove now that no matter when I stop the algorithm - if $p[v] = u$ always $d[v]\le d[u]+w(u,v)$ and to prove that a cycle in parent pointer is necessarily a negative cycle.

  • 1
    $\begingroup$ Where exactly is the problem, or where did you get stuck in your proof? $\endgroup$
    – Juho
    Nov 13, 2016 at 9:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.