Johnson’s Algorithm
- Re-weighting technique: If negative edges exist, compute w^ for
Dijkstra’s algorithm to work on.
- ∀u,v∈V, u⇝pv is shortest using w if and
only if the same applies using w^.
- w^(u,v)≥0∀(u,v)
- Define h as
- The new weight is given byture
- h:V→R is any mapping
- w^(u,v)=w(u,v)+h(u)−h(v)
- So that w^(p)=w(p)+h(v0)−h(vk)
- Determining w^ takes O(VE) time.
- Run Dijkstra’s algorithm on each vertex.
- With min-priority-queue in Dijkstra’s algorithm implemented
by fibonacci-heap, the runtime is O(V2lgV+VE), binary min-heap yields
O(VElgV).