There is a cycle if an adjacent is visited and present in recursion call stack recur [ ]
elif ( visited [ adj [ v ] [ i ] ] == True and recur [ adj [ v ] [ i ] ] == True ) : NEW_LINE INDENT return True NEW_LINE DEDENT recur [ v ] = False NEW_LINE return False NEW_LINE