Enhance SegmentWalker to handle cyclic data without infinite looping