Bellman Ford algorithm to calculate the shortest paths taking the negative edge weights into account.