Research Article

Hamiltonian Paths in Some Classes of Grid Graphs

Algorithm 1

The Hamiltonian path algorithm for 𝐿 -alphabet grid graphs.
procedure 𝐿 _HamiltonianPath ( 𝐿 ( 𝑚 , 𝑛 ) , 𝑠 , 𝑡 )
1:  if   𝐿 can be stripped then
2:   let 𝑆 be a strip of 𝐿 , where 𝑆 is an even-sized rectangular grid graph
3:    𝑃 𝑅 _HamiltonianPath ( 𝐿 𝑆 , 𝑠 , 𝑡 )
4:    𝐷 HamiltonianCycle ( 𝑆 )
5:   return MergeStrip ( 𝑃 , 𝐷 , 𝑠 , 𝑡 )
6:  else
7:   let 𝐿 be split to 𝑅 𝑝 and 𝑅 𝑞
8:    𝑃 1 𝑅 _HamiltonianPath ( 𝑅 𝑝 , 𝑠 , 𝑝 )
9:    𝑃 2 𝑅 _HamiltonianPath ( 𝑅 𝑞 , 𝑞 , 𝑡 )
10:   return MergeSplit ( 𝑃 1 , 𝑃 2 , 𝑝 , 𝑞 )
11:  end  if