raw function of cycle (with dummy head node)