Bellman Ford runs in O(VE) time, where V and E are the number of vertices and edges.
Here is a sample algorithm of Bellman-Ford
BF(G,w,s) // G = Graph, w = weight, s=source Determine Single Source(G,s); set Distance(s) = 0; Predecessor(s) = nil; for each vertex v in G other than s, set Distance(v) = infinity, Predecessor(v) = nil; for i <- 1 to |V(G)| - 1 do //|V(G)| Number of vertices in the graph for each edge (u,v) in G do if Distance(v) > Distance(u) + w(u,v) then set Distance(v) = Distance(u) + w(u,v), Predecessor(v) = u; for each edge (u,r) in G do if Distance(r) > Distance(u) + w(u,r); return false; return true;