OpenGenus / cosmos

World's largest Contributor driven code dataset | Used in Quark Search Engine, @OpenGenus IQ, OpenGenus Visual Project

Home Page:http://internship.opengenus.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bellman Ford Modification

AmitMandhana opened this issue · comments

The Bellman Ford's Algorithm finds the single source shortest path without a negative cycle but if there is negative weight cycle how can we detect it?

Bellman Ford algorithm normally does n - 1 iterations. But if there is negative weight cycle, then it should relax even on the nth iteration.