Fix the `find_cycles` function work for 1-based indices.