Find the shortest walk with negative weighted edges, but not cycle.

Pseudo-code

BellmanFord(𝑠):1for 𝑖1 to 𝑉1:2for all edge 𝑢𝑣:3if 𝑢𝑣 is tense:4relax(𝑢𝑣)56for all edge 𝑢𝑣:7if 𝑢𝑣 is tense:8Fail// Negative cycle detected9

Runtime

𝑂(|𝑉𝐸|)