DFS Memory Requirements

How large does the stack S get?

Let a be the average size of an adjacency list Adj[u].

Let d be the current distance from the start vertex in the search.

When d is: The size of S is:
0 1
1 a