Depth-first Search Algorithm for SAW Enumeration

0. Decide on a fixed local search order around a site. Initialize all variables.

1. Occupy the starting point, set n = 1, and set search directioon index at this site as dir(1) = 1.

2. Test if all directions around site n have already been searched.

• If yes:

– Unoccupy site n.

– Decrement n ⟹ n − 1.

– If n = 0, you are done. Otherwise, repeat 2.

• If not, test the target in dir(n) from site n is available:

– If it is:

∗ Extend SAW to this site and add this walk to statistics.

∗ Increment dir(n).

∗ Test if n + 1 = n_{max}. · If it has, repeat 2. · If not: = Increment n ⟹ n + 1. = Occupy the target site. = Set dir(n) = 1. = Repeat 2.

– If it is not, increment dir(n) and repeat 2.