Graph Theory37 sections · 1633 units
Open in Course

Why Floyd Works

(The distance proof)

Let μ\mu be the tail length and λ\lambda be the cycle length. When they first meet, slow traveled μ+a\mu + a and fast traveled μ+b\mu + b where aa and bb differ by a multiple of λ\lambda. Since fast moves twice as fast, μ+b=2(μ+a)\mu + b = 2(\mu + a), so μ=b2a\mu = b - 2a.

This means μ\mu is a multiple of λ\lambda steps from bb. Resetting slow and moving both one step puts them at cycle start when they meet.