Every edge has three values ( u , v , w ) where the edge is from vertex u to v . And weight of the edge is w .
graph = [ [ 0 , 1 , - 1 ] , [ 0 , 2 , 4 ] , [ 1 , 2 , 3 ] , [ 1 , 3 , 2 ] , [ 1 , 4 , 2 ] , [ 3 , 2 , 5 ] , [ 3 , 1 , 1 ] , [ 4 , 3 , - 3 ] ] NEW_LINE BellmanFord ( graph , V , E , 0 ) NEW_LINE