Increment the frequency of u
fre [ ord ( S [ u ] ) - ord ( ' a ' ) ] += 1 NEW_LINE for i in adj [ u ] : NEW_LINE INDENT if ( visited [ i ] == 0 ) : NEW_LINE INDENT DFS ( i , fre , S ) NEW_LINE DEDENT DEDENT