Incorrect method for identifying vertices order in cycle