when DFS call on

ANYrandom node in the graph result in stack size of 5

Suppose there is a tree structured graph with height 5. We call DFS on root and the stack size becomes 5. But if we call on any other node we won't get stack size=5.

To get a stack size=5 on applying DFS to a node, there should be a path from that node which contains 4 other nodes as well. This is because DFS(node) will call each of the other 4 nodes one after the other making stack size = 5 [i.e the starting node + 4 other nodes].

Here we want the same result on applying DFS on any random node so every node should have a path starting from it that contains 4 other nodes.

If you think over it, this can be achieved when the graph is a complete graph with 5 nodes.

A complete graph on 5 nodes will have 10 edges.