# Hamiltonian Paths in the Square of a Tree

## Abstract

We introduce a new family of graphs for which the Hamiltonian path problem is non-trivial and yet has a linear time solution. The square of a graph *G* = (*V*,*E*), denoted as *G* ^{2}, is a graph with the set of vertices *V*, in which two vertices are connected by an edge if there exists a path of length at most 2 connecting them in *G*. Harary & Schwenk (1971) proved that the square of a tree *T* contains a Hamiltonian cycle if and only if *T* is a caterpillar, i.e., it is a single path with several leafs connected to it. Our first main result is a simple graph-theoretic characterization of trees *T* for which *T* ^{2} contains a Hamiltonian path: *T* ^{2} has a Hamiltonian path if and only if *T* is a horsetail (the name is due to the characteristic shape of these trees, see Figure 1). Our next results are two efficient algorithms: linear time testing if *T* ^{2} contains a Hamiltonian path and finding such a path (if there is any), and linear time preprocessing after which we can check for any pair (*u*,*v*) of nodes of *T* in constant time if there is a Hamiltonian path from *u* to *v* in *T* ^{2}.

## Keywords

tree square of a graph Hamiltonian path## Preview

Unable to display preview. Download preview PDF.

## References

- 1.Abderrezzak, M.E.K., Flandrin, E., Ryjáček, Z.: Induced S(K\(_{\mbox{1, 3}}\)) and Hamiltonian cycles in the square of a graph. Discrete Mathematics 207(1-3), 263–269 (1999)MathSciNetCrossRefMATHGoogle Scholar
- 2.Diestel, R.: Graph Theory, 4th edn. Springer, Heidelberg (2010)CrossRefMATHGoogle Scholar
- 3.Fleischner, H.: The square of every two-connected graph is Hamiltonian. J. Combin. Theory (Series B) 16, 29–34 (1974)MathSciNetCrossRefMATHGoogle Scholar
- 4.Georgakopoulos, A.: A short proof of Fleischner’s theorem. Discrete Mathematics 309(23-24), 6632–6634 (2009)MathSciNetCrossRefMATHGoogle Scholar
- 5.Georgakopoulos, A.: Infinite Hamilton cycles in squares of locally finite graphs (2006) (preprint)Google Scholar
- 6.Harary, F., Schwenk, A.: Trees with Hamiltonian square. Mathematika 18, 138–140 (1971)MathSciNetCrossRefMATHGoogle Scholar
- 7.Hendry, G., Vogler, W.: The square of a S(K\(_{\mbox{1, 3}}\))-free graph is vertex pancyclic. Journal of Graph Theory 9, 535–537 (1985)MathSciNetCrossRefMATHGoogle Scholar
- 8.Karaganis, J.J.: On the cube of a graph. Canad. Math. Bull. 11, 295–296 (1968)MathSciNetCrossRefMATHGoogle Scholar
- 9.Lin, Y.-L., Skiena, S.: Algorithms for square roots of graphs. SIAM J. Discrete Math. 8(1), 99–118 (1995)MathSciNetCrossRefMATHGoogle Scholar
- 10.Sekanina, M.: On an ordering of the set of vertices of a connected graph. Technical Report 412, Publ. Fac. Sci. Univ. Brno. (1960)Google Scholar
- 11.Thomassen, C.: Hamiltonian paths in squares of infinite locally finite blocks. Annals of Discr. Math. 3, 269–277 (1978)MathSciNetCrossRefMATHGoogle Scholar
- 12.Řiha, S.: A new proof of the theorem by Fleischner. J. Comb. Theory Ser. B 52, 117–123 (1991)MathSciNetCrossRefMATHGoogle Scholar