Mark current as visited
visited [ current ] = True ; NEW_LINE for i in range ( len ( g [ current ] . children ) ) : NEW_LINE INDENT v = g [ current ] . children [ i ] . first ; NEW_LINE if ( visited [ v ] ) : NEW_LINE INDENT continue ; NEW_LINE DEDENT DEDENT