storing the dfs traversal in the array e
def dfs ( src : int ) : NEW_LINE INDENT e . append ( src ) NEW_LINE visited [ src ] = True NEW_LINE for i in range ( len ( g [ src ] ) ) : NEW_LINE INDENT des = g [ src ] [ i ] NEW_LINE if not visited [ des ] : NEW_LINE INDENT dfs ( des ) NEW_LINE e . append ( src ) NEW_LINE DEDENT DEDENT DEDENT