Floyd Marshall algorithm.