负环(Negative-weight Cycle)与最短路径

负环(Negative-weight Cycle)与最短路径

Content #

If the graph contains a negative-weight cycle reahable from s, however, shortest-path weights are not well defined.

There are infinitely many paths from s to c:

<s,c>, <s,c,d,c>, <s,c,d,c,d,c>, ...

The shortest path from s to c is <s,c>.

There are infinitely many paths from s to e:

<s,e>, <s,e,f,e>, <s,e,f,e,f,e>, ...

Because the cycle <e,f,e> has weight -3, however, there is no shortest path from s to e.

From #