# count number of different DFS tree of specific graph - ladder

It is given graph. It isn't ordinary graph, it is ladder. We say that our ladder has order $n$, because of number of nodes. Look at picture:

My problem is: Let's start DFS on node number $1$. How many different DFS tree exist?

From my point of view I should count number of possible adjency lists. For example, for node number $1$ we have to possible adjency lists: $[2, 3]; [3, 2]$.

Is my approach ok ? What's your opinion ?

• We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. – D.W. Sep 24 '15 at 23:04

1. $$1 \to 2 \to 4 \to \dotsb$$ Start from node 4, it's just a DFS traversal of ladder of order $n-1$ rooted at node 4.
2. $$1 \to 3 \to \dotsb$$ Start from node 3, it's just a DFS traversal of ladder of order $n-1$ rooted at node 3, with one extra branch from 4 to 2. And there are 2 ways to insert branch 2, since node 4 in ladder of order $n-1$ rooted at node 3 is of degree 2, having exactly 1 parent and 1 child.
• So, from first case: $$T_{n-1}$$ from second case: $$T_{n-1}$$, $$T_{1}=1$$, Then $$T_{n} = 2T_{n-1} = 2^{n-1}$$. Ok ? – M.Swe Sep 22 '15 at 12:40