finding negative cycle with fewest edges

43 Views Asked by At

I want to find the shortest negative cycle (i.e. fewest edges) in a graph, if it exists. I was reading this question and it seems like Bellman-Ford can do this, if I run it starting from each vertex? So to clarify - is the idea that if the shortest negative cycle has N edges, and I happen to start from a vertex on this cycle, then after N steps of Bellman-Ford I will detect/find this cycle?

0

There are 0 best solutions below