To store the cycle vertex
cycle = [ ] NEW_LINE v = C NEW_LINE while ( True ) : NEW_LINE INDENT cycle . append ( v ) NEW_LINE if ( v == C and len ( cycle ) > 1 ) : NEW_LINE INDENT break ; NEW_LINE DEDENT v = parent [ v ] NEW_LINE DEDENT