1. Introduction
Interest in the enumeration and generation of Hamiltonian cycles in various families of graphs can be found in different domains of science. In chemistry, theoretical physics, and biophysics, the research is connected to the modeling of polymers [
1], polymer melting, protein folding [
2], and the study of magnetic systems with
symmetry [
3]. In the theory of algorithms, it is one of the most studied counting problems coming from the mathematical nanosciences [
4]. It has applications in coding theory according to [
5,
6,
7]. In engineering and bioinformatics, the research is connected to security and intellectual property protection [
8] and path planning problems for robots and machine tools [
9].
Studies on the topic of counting Hamiltonian cycles in different families of graphs and the use of similar (matrix) approaches are not negligible. In 1990, a characterization of Hamiltonian cycles of the Cartesian product
was established [
10]. In 1994, Kwong and Rogers developed a matrix method for counting Hamiltonian cycles in
, obtaining exact results for
[
11]. Their method was extended to arbitrarily large grids by Bodroža-Pantić et al. [
12] and by Stoyan and Strehl [
13]. Later, Bodroža-Pantić et al. gave some explicit generating functions for the number of Hamiltonian cycles in graphs
,
and
[
14,
15,
16]. Recently, Đokić et al. presented two algorithms for determination of the number of (all spanning unions of cycles) 2-factors in three classes of grid graphs: the thin cylinder
, torus
, and Klein bottle
, all of which had a width of
m [
17]. On the other hand, Vegi Kalamar et al. characterized all Hamiltonian cycles in 2-tiled graphs and efficiently counted them for a fixed family of tiles [
18]. Others have recently tackled other (less related) families of graphs: Fernandes et al. on the Matroid Basis Graph [
19], Liu et al. on planar triangulations [
20] and Ferber et al. on Dirac Hypergraphs [
21].
In the present contribution, we build on the results of [
18]. The introduced
k-traversing Hamiltonian cycles in tiled graphs are a generalization of zigzagging (1-traversing) and traversing (2-traversing) Hamiltonian cycles from 2-tiled graphs. We extend the results to counting traversing Hamiltonian cycles in an arbitrary family of tiled graphs.
We organize the remainder of the paper as follows. In
Section 2, we define tiled graphs as a generalization of 2-tiled graphs, define traversing Hamiltonian cycles in tiled graphs, and prove their possible existence. In
Section 3, we present an algorithm to count this type of Hamiltonian cycles and represent its value in a closed formula. In
Section 4, we propose open problems for further research.
2. Tiled Graphs and Traversing Hamiltonian Cycles
In this section, we introduce the concept of a tile as presented in [
18] and extend it to a definition of a tiled graph. We define the concept of
k-traversing Hamiltonian cycles in tiled graphs and prove their possible existence for certain values of
k.
Definition 1. A tile is a triple , consisting of a connected graph G and two sequences (left wall) and (right wall) of distinct vertices of G, with no vertex of G appearing in both x and y. We call T a -tile.
Example 1 (A tile). Same graph represented as a (2,3)-tile with one internal vertex and as a (3,3)-tile without an internal vertex.
![Mathematics 11 02650 i001]()
Definition 2. - 1.
The tiles and are compatible whenever
- 2.
A sequence of tiles is compatible if, for each , is compatible with .
- 3.
The join of compatible tiles and is the tile for which the graph is obtained from disjoint union of G and by identifying the sequence y term by term with the sequence .
- 4.
The join of a compatible sequence of tiles is defined as .
- 5.
A tile T is cyclically compatible if T is compatible with itself.
- 6.
For a cyclically compatible tile , the cyclization of T is the graph obtained by identifying the respective vertices of x with y.
- 7.
A cyclization of a cyclically compatible sequence of tiles is defined as .
- 8.
A tiled graph is a cyclization of a sequence of at least 3 tiles.
Example 2 (Join of tiles). Result of a join of tiles from the left side is a (2,2)-tile on the right side.
Example 3 (Cyclization of a tile). Cyclization of the left side tile results in a graph where the vertices of the left wall are identified with the vertices of the right wall.
The following lemma is crucial in understanding of a structure of Hamiltonian cycles in tiled graphs. It is an extension of claims 1–3 of Lemma 1 from [
18] to tiled graphs.
Lemma 1. Let C be a Hamiltonian cycle in a tiled graph . Then, we have the following:
- 1.
.
- 2.
is a union of paths and isolated vertices.
- 3.
Let v be a vertex of a component of . Then, v has degree 2 in or v is a wall vertex.
Proof. - 1.
- 2.
Let K be a component of . As C is a cycle, K is a connected subgraph of C. Then, K is either equal to C, a path, or a vertex. If , then contains all the vertices of G, a contradiction to (in at least one tile, C does not contain all the vertices). The claim follows.
- 3.
Let v be a vertex of of degree different from 2. As the maximum degree of vertex in C is 2, v has degree 1 or 0. If v is an internal vertex of , its degree in is equal to its degree in . This contradicts C being a cycle and the claim follows.
□
Definition 3. Let be a tiled graph and the set of all isolated vertices in . For , Hamiltonian cycle C is k-traversing, if , is a set of k paths that start in a vertex of left wall and end in a vertex of right wall that cover all internal vertices of .
Definition 4. Let be a tiled graph, where is a -tile. The minimum wall size of a tiled graphs G is defined as .
The following result (using claim 4 of Lemma 1 from [
18] as a basis) directly follows from claims of Lemma 1.
Corollary 1. Let be a tiled graph, where is a -tile. If a k-traversing Hamiltonian cycle exists in G, then .
Proof. By Claim 3 in Lemma 1, paths start and end in a wall vertex. Each traversing path is a distinct non-degenerate path and has at least two unique wall vertices, one from the left wall and one from the right wall. For a tile , the number of such paths is at most and the claim for the whole graph follows from the fact that . □
3. Counting Traversing Hamiltonian Cycles in Tiled Graphs
In this section, we introduce structures that enable us to describe an algorithm for counting traversing Hamiltonian cycles and prove its correctness. We further show that, in the case of a fixed set of tiles, this algorithm is efficient.
According to Definition 3, k-traversing Hamiltonian cycles can be obtained by “gluing” k disjoint paths covering all internal nodes of a tile between neighboring tiles. We must pay attention to the following things:
- 1.
Each of the k paths in a tile has to be “glued together” with exactly one of the k paths in the neighboring tile.
- 2.
When we “glue” all k paths in neighboring tiles, on a shared wall each node must belong to exactly on of the k paths.
- 3.
When “gluing together” k paths in the entire tiled graph, we must make sure that this is conducted in such a way that these “glued” k paths result in a single cycle.
In the following, we present the structures that will help us solve the presented challenges. To facilitate brevity, we have prepared
Table A1 with a summary of frequently used notations. It is located in
Appendix A.
Let
be a tiled graph, where
,
is a
-tile. For a tile
, let
. Let
be a set of strings of left endvertices of length
k (out of
options) and
be a set of strings of right endvertices of length
k (out of
options), both ordered lexicographically from smallest to largest. Then,
and
. Those sets will be used to model left-to-right transition modes. Let
denote an empty string. Additionally, let
be a set of all binary strings of length
(for remaining
left wall vertices) and
a set of all binary strings of length
(for remaining
left wall vertices),
both ordered lexicographically from largest to smallest. Then,
and
. Those sets will be used to model the coverage of wall vertices with paths within the current (bit value 1) or a neighboring tile (bit value 0). For element
x from sets
and
, let
denote a string where all bits are flipped and
.
Let
be a
block matrix
where,
,
(
p-th element in
) and
,
(
r-th element in
),
is a
matrix of form
where,
,
(
u-th element in
), and
,
(
v-th element in
),
represents the number of possible combinations in
for
k distinct paths covering all internal vertices that have ordered left wall endvertices
and ordered right wall endvertices
(defining paths
),
describing if remaining
left wall vertices are/are not part of any
k paths and
describing if remaining
right wall vertices are/are not part of any
k paths.
Example 4. Let T be a (2,3)-tiled graph with no internal (non-wall) vertex. Then, there may exist 1-traversing and 2-traversing paths:
1-traversing: In this case, the sets are the following:Thenwhere For example, denotes the number of possible combinations in T for one path covering all internal vertices, starting in , ending in , where the first remaining left wall vertex () is part of the path and the first remaining right wall vertex () is part of the path, but the second one () is not. See Figure 1. 2-traversing: In this case, the sets are the following:Thenwhere ,For example, denotes the number of possible combinations in T for two distinct paths covering all internal vertices, the first starting in and ending in , and second one starting in and ending in , where there is no remaining left wall vertex and the first remaining right wall vertex () is part of one of the paths. See Figure 2.
Let
be a
block matrix
where,
,
(
p-th element in
) and
,
(
r-th element in
),
is a
matrix of form
Example 5. Using tile from Example 4, we check the matrices:
1-traversing:where 2-traversing:where
Definition 5. Let be a -tile and a -tile that are compatible (). For , let be a matrix that belongs to and a matrix that belongs to . For a tile , we define a matrix aswhere · represents the block matrix multiplication Lemma 2. Matrix is a block matrix of formwhere, , (p-th element in ) and , (r-th element in ), is a matrix of formwhere, , (u-th element in ), and , (v-th element in ), represents the number of possible combinations in for k distinct paths covering all internal vertices that have ordered left wall endvertices and ordered right wall endvertices (defining paths ), describing if remaining left wall vertices are/are not part of any k paths and describing if remaining right wall vertices are/are not part of any k paths. Remark 1. Lemma 2 presents the counting of ways of “gluing” k paths in adjacent tiles.
Proof. Because tiles and are compatible, and . Since is a block matrix of dimension and is a block matrix of dimension , by definition of block matrix multiplication, is a block matrix of dimension . Since each block in is of dimension and each block in of dimension , by definition of block matrix multiplication, each block in is of dimension .
By definition of block matrix multiplication, element
of block
is calculated as
We have to show that
,
generates described paths in
.
Let and . Then, represents the number of possible combinations in for k distinct paths covering all internal vertices that have ordered left wall endvertices and ordered right wall endvertices x (defining paths ), describing if remaining left wall vertices are/are not part of any k paths and y describing if remaining right wall vertices are/are not part of any k paths. On the other side, represents the number of possible combinations in for k distinct paths covering all internal vertices that have ordered left wall endvertices x and ordered right wall endvertices (defining paths ), describing if remaining left wall vertices are/are not part of any k paths and describing if remaining right wall vertices are/are not part of any k paths.
It is clear that, if we identify those k paths by endvertices x (defining paths ), we cover all internal vertices in and , but also remaining vertices on shared wall (paths in cover remaining right wall vertices in , for which the bit value in y is 1, and paths in cover remaining left wall vertices in , for which the bit value in is 1) and the result follows. □
Example 6. We check out the product , where is a tile from Example 4 and the tile that we obtain if we switch walls in (those tiles are compatible).
1-traversing:where 2-traversing:where
Definition 7. For and , letbe the z-shift of b. Theorem 1. Let be a tiled graph and let . The number of distinct k-traversing Hamiltonian cycles in G is equal to Proof. Let
be a matrix that belongs to
. Then, it is a
block matrix of form
where
,
(
p-th element in
),
,
(
r-th element in
),
is a
matrix of form
Since graph
G is a result of identifications of left and right wall vertices in tile
,
and so
and
. We obtain that matrix
is a
block matrix of form
where
,
(
p-th and
r-th element in
),
is a
matrix of form
where,
,
(
u-th and
v-th element in
),
represents the number of possible combinations in
for
k distinct paths covering all internal vertices that have ordered left wall endvertices
and ordered right wall endvertices
(defining paths
),
describing remaining
left wall vertices are/are not part of any
k paths and
describing remaining
right wall vertices are/are not part of any
k paths.
To obtain the number from the matrix , we need to take into account only block matrices for which mapping of consecutive elements of into consecutive elements of () is a permutation of a set that can be decomposed into one disjoint cycle. Otherwise each sequence of paths identified by a disjoint cycle in the decomposition can generate a separate cycle. For , , is the desired permutation, and, for , it is easy to see, that , mappings , where , are the desired permutations.
From such block matrices
, only entries
add to the number
, since they cover all remaining vertices on the shared wall between tiles
and
exactly once. Because of the introduced lexicographic order on sets
,
Hence, if
,
,
and, if
,
are values that contribute to
.
However, since there are block matrices that calculate same cycles (ones that generate permutations over the same set), the total sum must be divided by . □
Remark 2. - 1.
If , for , setforms an anti-diagonal of block matrix . - 2.
If , for and , setforms an anti-diagonal of block matrix .
Using the above algorithm, some results from [
18] can be recreated. In it, 2-tiled graphs are investigated.
Example 7 (Counting traversing Hamiltonian cycles in 2-tiled graphs)
. For 2-tiled graphs, 1-traversing (denoted as zigzagging in [18]) and 2-traversing (denoted as traversing in [18]) Hamiltonian cycles may exist:1-traversing: The matrix is a block matrix, where each block is of dimension :
Then 2-traversing: The matrix is a block matrix, where each block is of dimension :Then
Corollary 2. Let be a finite family of tiles, and let be a family of cyclizations of finite sequence of such tiles. There exists and algorithm that yields, for each graph , the number . For a fixed set , the running time of the algorithm is linear in the number of tiles (and hence vertices) of G.
Proof. For a fixed family of tiles, we precalculate matrices (and so ). The time complexity to compute the matrix is and additional is needed to obtain the searched sum from it. □
4. Conclusions and Further Research
In this paper, we presented a solution to count traversing Hamiltonian cycles in tiled graphs. We accomplished it by introducing an extended matrix method from [
18], where the crucial part was the identification of matrices
. Similarly as in [
18] for 2-tiled graphs, in Corollary 2, we used the fact that, in a finite set of tiles, the generation of these matrices can be thought of as a constant problem, which resulted in that our algorithm’s running time is linear in the number of tiles (and hence vertices). In general, this is not true, so we now propose the following open problem:
Open problem. Find an (efficient) algorithm to generate block matrices .
By definition, traversing Hamiltonian cycles are such that their intersection with the tile results in paths that start in one wall and end in another wall of the tile. Obviously, however, there are also types of Hamiltonian cycles such that their intersection with a tile also allows paths that start and end in the same wall of the tile (flanking Hamiltonian cycles as an example in 2-tiled graphs [
18]). Therefore, we additionally propose the following open problems:
Open problem. Identify other types of Hamiltonian cycles in tiled graphs.
Open problem. Count other types of Hamiltonian cycles in tiled graphs.