on the graphic, 7 and 8 are inverted, also it seems the 6.083 distance whould have been 6.325
Spoiler for my take on it
Xavier is correct on both counts. I've modified the OP. Square root of 40 is 6.325.
Edit: both of these paths are just shy of optimal.