Constructing a path of near-constant length . Written to support this Stack Overflow answer.