Counting Hamiltonian cycles in 2-tiled graphs

In 1930, Kuratowski showed that $K_{3,3}$ and $K_5$ are the only two minor-minimal non-planar graphs. Robertson and Seymour extended finiteness of the set of forbidden minors for any surface. \v{S}ir\'{a}\v{n} and Kochol showed that there are infinitely many $k$-crossing-critical graphs for any $k\ge 2$, even if restricted to simple $3$-connected graphs. Recently, $2$-crossing-critical graphs have been completely characterized by Bokal, Oporowski, Richter, and Salazar. We present a simplified description of large 2-crossing-critical graphs and use this simplification to count Hamiltonian cycles in such graphs. We generalize this approach to an algorithm counting Hamiltonian cycles in all 2-tiled graphs, thus extending the results of Bodro\v{z}a-Panti\'c, Kwong, Doroslova\v{c}ki, and Panti\'c for $n = 2$.


Introduction
In 1930, Kuratowski has characterized graphs that can be drawn in a plane with no crossings (i.e. planar graphs) as the graphs that do not contain a subgraph isomorphic to a subdivision of K 3,3 or K 5 . This result inspired several characterizations of graphs by forbidden subgraphs, which paved paths into significantly different areas of graph theory. Extremal graph theory is concerned with forbidding any subgraph isomorphic to a given graph [3] and maximizing the number of edges under this constraint. Significant structural theory was developed when forbidden subgraphs were replaced by forbidden induced subgraphs, for instance several characterizations of Trotter and Moore [36] and the remarkable weak and strong perfect graph theorems [10,28]. Graph minor theory extended the Kuratowski theorem to higher surfaces showing that the set of graphs embeddable into any surface can be characterized by a finite set of forbidden minors [32]. The exact characterization is known for the projective plane [1], but already on the torus, the number of forbidden minors reaches into tens of thousands [19]. Mohar devised algorithms to embed graphs on surfaces [30], which was later improved by Kawarabayashi, Mohar, and Reed [24]. Characterizations of graph classes with subdivisions received somewhat less renowned attention. Early on the above path, Chartrand, Geller, and Hedetniemi pointed at some common generalizations of forbidding a small complete graph and a corresponding complete bipartite subgraph as a subdivision, resulting in empty graphs, trees, outerplanar graphs, and planar graphs [9]. That unifying approach apparently did not yield to fruitful results, but more recently, Dvořák established a characterization of several graph classes using forbidden subdivisions [12] reaching even outside of topological graph theory. Within its limits, a next step from the Kuratowski theorem was established by Bokal, Oporowski, Salazar, and Richter [8], who characterized the complete list of minimal forbidden subdivisions for a graph to be realizable in a plane with only one crossing. These graphs are called 2-crossing-critical graphs and exhibit a richer structure compared to fixed-genus-embedded graph families: unlike graphs realizable in a plane with a limited number of handles that can be characterized by a finite number of forbidden minors (and hence, finite number of forbidden subdivisions), the graphs realizable in a plane with at most one crossing already exhibit infinite families of topologically-minimal obstruction graphs, as first demonstrated byŠiřan [33]. Kochol extended this result to simple, 3-connected graphs [25].
Interest has also been shown in finding forbidden subgraphs that imply Hamiltonicity of graphs. In 1974, Goodman and Hedetniemi showed that a graph not containing induced K 1,3 and K 1,3 +e, where e creates a 3-cycle, is Hamiltonian [20]. A series of several similar results was closed in 1997 by Faudree and Gould, who characterized all pairs of graphs such that forbidding their induced presence in a graph implies graph's Hamiltonicity [16]. This was via several papers extended to a complete characterization of triples of forbidden graphs implying Hamiltonicity, the final one being [17].
Beyond establishing the Hamiltonicity of graphs, counting Hamiltonian cycles is of some interest. The interest originates in biochemical modelling of polymers [11], where a collapsed polymer globule is modelled by a Hamiltonian cycle, and the number of Hamiltonian cycles corresponds to the entropy of a polymer system in a collapsed, but disordered phase. This shows an interesting intuitive duality to counting Eulerian cycles that showed relevance in constructing controlled, de novo protein structure folding [2,21]. In 1990, a characterization of Hamiltonian cycles of the Cartesian product P 4 P n was established [35]. In 1994, Kwong and Rogers developed a matrix method for counting Hamiltonian cycles in P m P n , obtaining exact results for m = 4, 5 [27]. Their method was extended to arbitrarily large grids by Bodroža-Pantić et al. [6] and by Stoyan and Strehl [34]. Later, Bodroža-Pantić et al. gave some explicit generating functions for the number of Hamiltonian cycles in graphs P m P n and C m P n [4,5]. Earlier, Saburo developed a field theoretic approximation of the number of Hamiltonian cycles in graphs C m C n in [22], as well as in planar random lattices [23]. Fireze et al. have considered generating and counting Hamiltonian cycles in random regular graphs [18]. Although it cannot be claimed that all 2-crossing-critical graphs are Hamiltonian (Petersen graph being a most known counterexample), the claim is fairly easy to see for large such graphs using the aforementioned characterization of 2-crossing-critical graphs. In this paper, however, we investigate the total number of different Hamiltonian cycles in a (large) 2-crossing-critical graph. It may be relevant that the dissertation [15] similarly investigates links between 2-crossing-critical graphs, graph embeddings, and Hamiltonian cycles in higher surfaces.
In addition to an alphabetic description of large 2-crossing-critical graphs that may inspire further investigation of this graph class and ease access to graph-theoretic research building on this next step beyond the Kuratowski theorem, we extend this body of research on counting Hamiltonian cycles by going beyond Cartesian products of paths and cycles, and apply the matrix method for counting Hamiltonian cycles to 2-tiled graphs, which include large 2-crossingcritical graphs. By allowing for non-planar graphs in our approach, a new type of Hamiltonian cycles appears, not observed in the previous research. We complement their approach of devising generating functions (which is feasible for well-structured graphs, such as aforementioned Cartesian products) by an algorithm, which is in the case of 2-crossingcritical graphs implementable in linear time, and can for certain subfamilies of 2-crossing-critical graphs be simplified to a closed formula, using just the counts of specific letters in our alphabetic representation of the 2-crossing-critical graph. Specifically, we constructively prove the following theorems:  The theorem has the following easier-to-state corollary: Corollary 2. There exists an integer N , such that any 2-connected 2-crossing-critical graph G with at least N vertices is Hamiltonian.
As Petersen graph is a 3-connected 2-crossing-critical graph and is not Hamiltonian, containing V 10 subdivision (or, equivalently, being large) cannot simply be ommited for the above conclusions.
The algorithm in Theorem 1 is a special case of the general algorithm from the following theorem: Theorem 3. Let T be a finite family of tiles with all wall sizes equal to two, and let G be a family of cyclizations of finite sequences of such tiles. There exists an algorithm that yields, for each graph G ∈ G, the number of distinct Hamiltonian cycles in G. The running time of the algorithm is quadratic in the number of tiles (and hence vertices) of G.
by adapting the general counting algorithm to 2-crossing-critical graphs. Section ?? concludes with a discussion on the pedagogical and scientific value of 2-crossing-critical graphs for both graph-theoretical as well as general scientific community.

Hamiltonian cycles in 2-tiled graphs
In this section, we introduce the concept of a tile that was first formalized by Pinontoan and Richter [31], and k-tiled graphs. We use the notation introduced in [8].

Definition 4.
A tile is a triple T = (G, x, y), consisting of a graph G and two sequences x = (x 1 , x 2 , . . . , x k ) (left wall) and y = (y 1 , y 2 , . . . , y l ) (right wall) of distinct vertices of G, with no vertex of G appearing in both x and y. If |x| = |y| = k, we call T a k-tile.
We use the following notation when combining tiles: 3. The join of compatible tiles (G, x, y) and (G ′ , x ′ , y ′ ) is the tile T = (G, x, y) ⊗ (G ′ , x ′ , y ′ ) whose graph is obtained from disjont union of G and G ′ by identifying the sequence y term by term with the sequence x ′ . 4. The join of a compatible sequence T = (T 0 , T 1 , . . . , T m ) of tiles is defined as ⊗T = T 0 ⊗ T 1 ⊗ · · · ⊗ T m . 5. A tile T is cyclically compatible if T is compatible with itself. 6. For a cyclically-compatible tile T = (G, x, y), the cyclization of T is the graph •T obtained by identifying the respective vertices of x with y. 7. A cyclization of a cyclically-compatible sequence of tiles T is defined as •T = •(⊗T ). 8. A k-tiled graph is a cyclization of a sequence of at least (k + 1) k-tiles.
It may be interesting to note that k-tiled graphs and operations on them can be interpreted in the context of operations on labeled graphs introduced in Lovász'es seminal book on large networks and graph limits [29]. Hence, introductory understanding of here presented concept may motivate researchers to pursuit that direction. We do not harmonize the notation here, but it may be feasible to do so when extending the theory of tiles to the theory of wedges, investigating an open problem from [7]. Lemma 6. Let C be a Hamiltonian cycle in a 2-tiled graph G = •(T 0 , T 1 , . . . , T m ). Then: 2. C ∩ T i is a union of paths and isolated vertices. 3. Let v be a vertex of a component of C ∩ T i . Then, v has degree 2 in C ∩ T i , or v is a wall vertex. 4. There are at most two distinct non degenerated paths in C ∩ T i . 5. If C ∩ T i consists of distinct non degenerated paths P 1 and P 2 , then C ∩ T i = P 1 ⊕ P 2 . Proof.
2. Let K be a component of C ∩ T i . 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 K = C, then T i contains all the vertices of G, a contradiction to m ≥ 2 (in at least one tile, C does not contain all the vertices). The claim follows. 3. Let v be a vertex of C ∩ T i of degree different from 2. As maximum degree in C is 2, v has degree 1 or 0. If v is an internal vertex of T i , its degree in C = m i=0 (C ∩ T i ) is equal to its degree in C ∩ T i . This contradicts C being a cycle and the claim follows. 4. By Claim 3, paths start and end in a wall vertex. Each distinct non degenerated path needs 2 unique wall vertices, and the claim follows. 5. By Claim 4, P 1 and P 2 contain all the wall vertices. By Claim 3, isolated vertices can only be wall vertices, hence there are no isolated vertices and C ∩ T i = P 1 ⊕ P 2 .
Corollary 7. Let C be a Hamiltonian cycle in a 2-tiled graph G = •(T 0 , T 1 , . . . , T m ) and N i the set of isolated vertices in C ∩ T i . Then, (C ∩ T i ) \ N i is one of the following: 1. A path that begins in a vertex of the left wall, ends in a vertex of the right wall and covers all internal vertices of T i .

2.
A pair of distinct paths that each begins and ends in the opposite walls, span T i and respect the vertex order of the walls. 3. A pair of distinct paths that each begins and ends in the opposite walls, span T i and invert the vertex order of the walls. 4. An empty set. 5. A pair of distinct paths that each begins and ends in the same wall and span T i . 6. A path that begins and ends in the same wall and covers all internal vertices of T i .
We say that a path "traverses" a 2-tile, if it starts in the left wall and ends in the right wall of a 2-tile. Based on Corollary 7, we define three groups of C-types of tiles as follows: Definition 8. Let C be a Hamiltonian cycle in a 2-tiled graph G = •(T 0 , T 1 , . . . , T m ), x = (x 1 , x 2 ) the left and y = (y 1 , y 2 ) the right wall of T i .
1. If a cycle C traverses T i with a single path and covers all internal vertices of T i , then T i is of zigzagging C-type, of which there exist four kinds, relevant for completing the Hamiltonian cycles between the tiles. First, T i is of zigzagging C-type {x3−j } − {y 3−k } , if C ∩ T i contains a single path P , the endvertices of P are vertices x j and y k of distinct walls of T i and P contains the non-endvertex wall vertices x 3−j , y 3−k . If either wall vertex that is not endvertex of P is not contained in P , then C ∩ T i contains a path P and these vertices as isolated vertex components. We denote such isolated components by an overline, leading to zigzagging C-types If a cycle C traverses T i with a pair of distinct traversing paths that span T i , then T i is of traversing C-type.
(a) T i is of aligned 1 traversing C-type =, if C ∩ T i contains a pair of distinct paths P 1 and P 2 , the endvertices of P 1 are x 1 and y 1 , and the endvertices of P 2 are x 2 and y 2 .
contains a pair of distinct paths P 1 and P 2 , the endvertices of P 1 are x 1 and y 2 , and the endvertices of P 2 are x 2 and y 1 .

If a cycle C does not traverse
contains a pair of distinct paths P 1 and P 2 , the endvertices of P 1 are x 1 and x 2 , and the endvertices of P 2 are y 1 and y 2 .
contains a single path P , the endvertices of P are x 1 , x 2 of the same wall of T i and P contains the non-endvertex wall vertices y 1 , y 2 . If either wall vertex that is not endvertex of P is not contained in P , then C ∩ T i contains a path P and these vertices as isolated components. We denote this by an overline, leading to flanking C-types | {y 1 ,y2} , | {y1,y 2 } , | {y 1 ,y 2 } . Respective notation for flanking C-types of P with endvertices y 1 , We denote with Λ z the set of all possible zigzagging C-types, with Λ t the set of all possible traversing C-types and with Λ f the set of all possible flanking C-types. Finally, we set Λ = Λ z ∪ Λ t ∪ Λ f .
We refer to C-types by their group name or by their notation. The first type of reference is used in the case of the reference to the whole group of C-types, the second one is used in the case of the reference to a specific C-type.
Lemma 9. Let C be a Hamiltonian cycle in a 2-tiled graph G = •(T 0 , T 1 , . . . , T m ). Then, precisely one of the following holds: . . , m}: T i and T i+1 are of compatible flanking C-type of form | {x,y} and {z,w} |, respectively and Proof.
1. We will prove that if T i is of zigzagging C-type, then the same holds for T i−1 and T i+1 . Suppose that T i is of zigzagging C-type. Then T i has the property that exactly one of its left and one of its right wall vertices have a degree 1 in C ∩ T i (the ones that are endvertices of the path from left to right wall). Because the degree of every vertex in C is 2, the left wall vertex has degree 1 in C ∩ T i−1 and the right wall vertex has degree 1 in C ∩ T i+1 . Because the degree of every vertex in C is 2, other wall vertices are either of degree 0 (isolated vertex) or 2 (vertex is part of a path) in C ∩ T i . If a wall vertex is of degree 0 (2) in C ∩ T i , then its degree in . Hence, based on the Corollary 7, T i−1 and T i+1 are of zigzagging C-type. By extending the argument to their neighbors, we established Claim 1 of the Lemma 9. For the rest of the proof, we may therefore assume that none of the tiles are of zigzagging C-type. 2. Let T i be of C-type . Let P 1 ⊕ P 2 be paths in C ∩ T i . Assume without loss of generality that P 1 starts in x i 1 and ends in x i 2 , P 2 starts in y i 1 and ends in , Q k ∩ T j is non-trivial and connected, otherwise Q k would not be connected. Hence (Q 1 ∩ T j ), (Q 2 ∩ T j ) are vertex disjoint paths in T j that cover all internal vertices (C is Hamiltonian cycle) with endvertices in the opposite walls. So T j is of traversing C-type. We established Claim 2 of the Lemma 9 and for the rest of the proof we may assume none of the tiles is of C-type .
Then C ∩ T i consists of some isolated vertices (candidates are y i 1 , y i 2 ) and path P i . Because any isolated vertex of C ∩ T i is part of a path of a neighbouring tile (in this case T i+1 ) and is not the endvertex of this path, there is a path P i+1 in C ∩ T i+1 whose endvertices are y i+1 1 , y i+1 2 and covers possible isolated nodes y i and path P i+1 , where P i+1 is a path whose endvertices are y i+1 and (similarly as in Item 2 of the proof of Lemma 9) T j is of traversing C-type. We established Claim 3 of the Lemma 9 and for the rest of the proof we may assume each tile of C-type | {y1,y2} has an adjacent tile of C-type ∅.
and covers these isolated nodes y i+1 and (similarly as in Item 2 of the proof of Lemma 9) T j is of traversing C-type. We established Claim 4 of the Lemma 9 and for the rest of the proof we may assume there are no tiles of C-type of form | {x,y} . 5. Assume now there is a tile T i of C-type of form {z,w} |. Then, as we assumed there are no tiles of C-type of form | {x,y} , a symmetric argument to Item 3 of the proof of Lemma 9 implies T i−1 is of C-type ∅ (hence T i can only be of C-type {x1,x2} |). But then a symmetric argument to Item 4 of the proof of Lemma 9 implies T i−2 is of C-type | {y1,y2} , a contradiction to the assumption that implies all tiles are either of C-type ∅ or traversing C-type.
If there is at least one tile T i of C-type ∅, then C ∩T i+1 ⊗· · ·⊗T m ⊗T 0 ⊗· · · T i−1 consists of at least two disconnected paths Q 1 and Q 2 . But, as C only intersects T i in wall vertices, C is equal to C ∩ T i+1 ⊗ · · · ⊗ T m ⊗ T 0 ⊗ · · · T i−1 , a contradiction implying all the tiles are of traversing C-types.
The remaining case is that ∀i : T i is of traversing C-type. So ∀i : where each path starts in a left wall vertex and ends in a right wall vertex. Without loss of generality, we may assume that, ∀k ∈ {1, 2}, P 0 k , P 1 k , . . . P m k are such that ∀j ∈ {0, 1, . . . , m}, P j k ends in same vertex as P j+1 k starts (if not, we can reindex them). Without loss of generality, we may assume that P 0 1 starts in x 0 1 and P 0 2 in x 0 2 . Each tile of C-type × implies that the path moves from the top left wall vertex to the bottom right wall vertex and from the bottom left wall vertex to the top right wall vertex. In case of even number of tiles Hamiltonian cycles of type 2, 3, and 4 from Lemma 9 are of similar construction, so we use the same name for all of them.
i, j are considered cyclically. Then, Using Definition 11, we define as follows: Definition 12. Let G = •(T 0 , T 1 , . . . , T m ) be a 2-tiled graph. For λ ∈ Λ and i ∈ {0, 1, . . . , m}, let We prove that the number of Hamiltonian cycles of each type can be counted efficiently. In the counting of Hamiltonian cycles that follows, index 0 will be used for the starting condition of the recursive counting, i. e. when there are no tiles. We adjust to this notation by using 1 based labelling for tiles throughout the rest of Section 2. By definition of cyclization, T m+1 = T 1 . Proof. For i ∈ {1, 2, . . . , m}, let

Counting traversing Hamiltonian cycles
Then, for each i ∈ {1, 2, . . . , m}: Then We define starting condition c 0 as because in an empty graph, there are zero (even) number of tiles of C-type ×. By Lemma 9, the number of traversing Hamiltonian cycles in G is equal to c m odd (combination of tiles with even number of tiles of C-type × gives us two distinct cycles that contain all vertices of a 2-tiled graph). Because each 2-tile has a constant number of vertices, we can calculate matrices R i in time O(1). The time complexity to compute the product R m · R m−1 · · · R 1 and then the number c m odd is O(m).

Counting flanking Hamiltonian cycles
Definition 14. We say that a cycle "turns around" in a 2-tile, if there exist two vertex disjoint paths, one with both endvertices in the left wall and the second one with both endvertices in the right wall that cover all internal vertices of a 2-tile. Proof. For i ∈ {1, 2, . . . , m}, let • a i,i+l number of distinct possibilities for T i , T i+1 , . . . , T i+l to be of compatible flanking C-types to turn around a cycle in T i,i+l .
To get the number of flanking Hamiltonian cycles that turn around in T i,i+l , i ∈ {1, 2, . . . , m}, we do the following: 1. We calculate the value a i,i+l . 2. Using the idea from proof for traversing Hamiltonian cycles over the sequence (T i+l+1 , . . . , T m , T 1 , . . . where c 0 is as in (3). Then c i+l+1,i−1 even presents number of different combinations of C ∩T i+l+1 ⊗· · ·⊗T m ⊗T 1 ⊗· · ·⊗ T i−1 with even number of tiles of traversing C-type × and c i+l+1,i−1 odd presents number of different combinations of C ∩ T i+l+1 ⊗ · · · ⊗ T m ⊗ T 1 ⊗ · · · ⊗ T i−1 with odd number of tiles of traversing C-type ×.
3. The number of Hamiltonian cycles turning around in T i,i+l is equal to Hence the total number of Hamiltonian cycles, turning around in the join of (l + 1) consecutive tiles in graph G is equal to Because there are finitely many different tiles and l is a constant, values a i,i+l and matrices R i can be calculated in time O(1). The time complexity to compute the product R i−1 · · · R 1 · R m · · · R i+l+1 and then the number c i+l+1, Suppose that every matrix R j , j ∈ {1, 2, . . . , m}, is invertible ((a j = ) 2 − (a j × ) 2 = 0), and let c m = R m · · · R 1 · c 0 be as in (2). We can get the value c i+l+1,i−1 even + c i+l+1,i−1 odd by solving the equation Because matrices R j , j ∈ {1, 2, . . . , m} are invertible, we get In Proof. We can get flanking Hamiltonian cycles in three ways: 1. cycle turns around in one tile, 2. cycle turns around in two consecutive tiles, 3. cycle turns around in three consecutive tiles.

Counting flanking Hamiltonian cycles that turn around in one tile:
Flanking Hamiltonian cycles that turn around in one tile consist of two parts. One tile is of C-type , other tiles are of traversing C-type. Using Lemma 15 with l = 0 and a i,i+l = a i , we get the desired result.

Counting flanking Hamiltonian cycles that turn around in two consecutive tiles:
In consecutive tiles T i and T i+1 , we have y i 1 = x i+1 1 and y i 2 = x i+1 2 . Then the number of distinct possibilities for T i and T i+1 to be of compatible flanking C-types of form | {x,y} and {z,w} | is equal to

Counting flanking Hamiltonian cycles that turn around in three consecutive tiles:
If we look at three consecutive tiles T i , T i+1 and T i+2 then y i Then the number of distinct possibilities to turn around in three consecutive tiles T i , T i+1 and T i+2 is equal to Flanking Hamiltonian cycles that turn around in three consecutive tiles consist of two parts. In consecutive tiles T i , T i+1 , and T i+2 , respectively, the C-types that are used are |{y 1 , y 2 }, ∅, and {x 1 , x 2 }|. Other tiles are of traversing C-type. Using Lemma 15 with l = 2 and a i,i+l = a]∅[ i,i+1,i+2 , we get the desired result. Proof. We observe that there exist 4 possibilities for covering wall vertices of the same wall in a 2-tile of zigzagging C-type from Definition 8:

Counting zigzagging Hamiltonian cycles
1. x 1 is an endvertex of a path and x 2 is part of a path (notation (x 1 , x 2 )), 2. x 2 is an endvertex of a path and x 1 is part of a path (notation (x 2 , x 1 )), 3. x 1 is an endvertex of a path and x 2 is an isolated vertex (notation (x 1 , x 2 )), 4. x 2 is an endvertex of a path and x 1 is an isolated vertex (notation (x 2 , x 1 )).
For i ∈ {1, 2, . . . , m} and (k, In adjacent tiles T i and T i+1 , we have y i Then We define different starting conditions c 0 , dependent from the starting type (k, l) in the first tile (in this notation T 1 ): • for (k, l) = (x 1 , x 2 ): For each starting type (k, l), we get the equation Because of the definition of cyclization, we get zigzagging Hamiltonian cycles if we have a combination of tile types with compatible starting type in tile T 1 and ending type in tile T m (we can combine them to cycles). Hence the number of zigzagging Hamiltonian cycles in a graph G is equal to which is equal to tr(Z m · Z m−1 · · · Z 1 ).
To compute this number, we have to efficiently calculate matrices Z i . Because there is a finite number of different tiles, we can compute them in time O(1). The time complexity to compute the product Z m · Z m−1 · · · Z 1 and then the number Theorem 3. Let T be a finite family of tiles with all wall sizes equal to two, and let G be a family of cyclizations of finite sequences of such tiles. There exists an algorithm that yields, for each graph G ∈ G, the number of distinct Hamiltonian cycles in G. The running time of the algorithm is quadratic in the number of tiles (and hence vertices) of G.
Proof. By Lemma 9, we know that there exist three types of Hamiltonian cycles in such a graph (traversing, flanking and zigzagging 3 Large 2-crossing-critical graphs as 2-tiled graphs In this section, we introduce 2-crossing-critical graphs and their characterization from [8]. We continue with the introduction of an alphabet describing the tiles, which are the construction parts of large 2-crossing-critical graphs. Further details are elaborated in [37].      L dL Figure 8: Alphabet letters describing frames.
In connection with the introduced signature, we will later use the following notation: • for X ∈ {B, D, A, V, H, I, d}, #X is the number of occurrences of X in sig(G), • for j ∈ {0, 1, . . . , 2m} and X ∈ {B, D, A, V, H, I, d}, # j X is the number of occurrences of X in sig(T j ), • for j ∈ {0, 1, . . . , 2m}, p ∈ {P t , P b } and X ∈ {B, D, A, V }, # p j X is the number of occurrences of X as sig(T j ) p .

Hamiltonian Cycles in large 2-crossing-critical graphs
In this section, we use the fact that large 2-crossing-critical graphs are a special case of 2-tiled graphs with finite set of tiles, to efficiently count Hamiltonian cycles with the use of algorithms from Section 2.
Remark 21. In construction of large 2-crossing-critical graphs, degree one vertices of adjacent tiles that are to be identified are suppressed after the identification, so that there is no degree 2 vertex in G (see [8] for details). Because of this, we define a new type of frames, which are obtained from original frames by removing the tail of a frame (see Figure  9). We use these frames for constructing tiles in S. Then, the cyclization of old tiles with additional suppression of a vertex is equivalent to the cyclization of new tiles. Note that all old graphs are the same as new ones, but the new tiles are not 2-degenerate, hence for this method of construction of large 2-crossing-critical graphs, Theorem 2.18 from [8] does not yield 2-crossing-criticality. Each tile in a new set S is a 2-tile and large 2-crossing-critical graphs are obtained by cyclization of at least three such 2-tiles. So by Definition 5, they are 2-tiled graphs. Because of that, we can use the algorithms from Section 2 to count Hamiltonian cycles (efficiently). Let be matrices of tiles from S (R is from equation (1) and Z from equation (4)).

Remark 22.
In construction of large 2-crossing-critical graphs, tiles at odd index (even index in algorithms) are inverted (see [8] for details). The matrices in algorithms for such tiles (inverted ones) can be obtained from the original ones in time O(1): In construction of large 2-crossing-critical graphs, there is a twist in connecting the last and the first tile (see [8] for details). The matrices in algorithms for the last tile (the right-inverted one) can be obtained from the original one in time O(1): Remark 24. As the tiles in S are planar, none of them contains an intertwined pair of disjoint paths, hence none of the tiles from the set S is of C-type ×. Using this observation with Remark 22 and Remark 23, we get that, for each tile in S, the following holds: Corollary 25. Let G ∈ T (S). The number of traversing Hamiltonian cycles in G is equal to where a i = is the number of possibilities for T i to be of C-type =. Proof. Using Remark 24 in equation (1), for i ∈ {1, 2, . . . , 2m}, we get Then c 2m+1 = a 2m+1 = · a 2m = · · · a 1 = · 0 1 1 0 Hence Corollary 26. Let G ∈ T (S). The number of traversing Hamiltonian cycles in G is equal to T HC(G) = 2 #B+#D+#H+#I+#d .
Proof. We have shown before that T HC(G) = 2m+1 i=1 a i = .
Using the alphabet defined above, we notice that Then Corollary 27. Let G ∈ T (S). The number of flanking Hamiltonian cycles in G is equal to

where • T HC(G) is the number of traversing Hamiltonian cycles in G,
• a i = is the number of possibilities for T i to be of C-type =, • a i is the number of possibilities for T i to be of C-type , is the number of distinct possibilities for T i and T i+1 to be of compatible flanking C-types of form | {x,y} and {z,w} |.
Proof. As shown in the proof of Lemma 16, It is easy to check that, for each tile in S, the value a = > 0. Using observations and the result from proof of Corollary Corollary 28. Let G ∈ T (S). The number of flanking Hamiltonian cycles in G is equal to Proof. We have shown in proof of Corollary 26 that a i = = 2 #iD+#iB+#iH+#iI+#id . It is easy to see that It remains to show that a i,i+1 Figure 10, it is easy to see that For a i | {y 1 ,y 2 } all pictures, except H, are valid and paths B, D add a multiplier 2. Hence For a i+1 {x 1 ,x 2 } | all pictures, except H, are valid and paths B, D and the frame dL add a multiplier 2. Hence  Figure 11, it is easy to see that • the top path is V , the bottom path is any of possible ones, except B, and the frame dL adds a multiplier 2, • the top path is H and the frame dL adds a multiplier 2.
The first and the third option both cover the picture with the top path V and the bottom path V . Hence For a i | {y 1 ,y 2 } there are several options: • the top path is V , the bottom path is any of possible ones, and bottom paths B, D add a multiplier 2, • the top path is B, the bottom path is any of possible ones, and the top path B and bottom paths B, D add a multiplier 2, • the bottom path is V , the top path is any of possible ones, except B, • the top path is H. The first and the third option both cover the picture with the top path V and the bottom path V . Hence For the a i+1 {x 1 ,x 2 } | all pictures, except H, are valid and paths B, D and the frame dL add a multiplier 2. Hence Proof. To count zigzagging Hamiltonian cycles, the algorithm from proof of Lemma 17 with a slight difference (explained in Remark 22 and Remark 23) is used: ZHC(G) = tr(Z 2m+1 · Z 2m · Z 2m−1 · · · Z 3 · Z 2 · Z 1 ) = tr((X · Z 2m+1 ) · (X · Z 2m · X) · Z 2m−1 · · · Z 3 · (X · Z 2 · X) · Z 1 ) = tr((X · Z 2m+1 ) · (X · Z 2m ) · (X · Z 2m−1 ) · · · (X · Z 2 ) · (X · Z 1 )), where X is the matrix from Remark 23. The lower bound is achieved by a graph G ∈ T (S), where ∀i ∈ {1, 2, . . . , 2m + 1} : sig(T i ) = D D dL. In this case, the matrices Z i are the following: Then (X · Z 2m+1 ) · (X · Z 2m ) · (X · Z 2m−1 ) · · · (X · Z 2 ) · (X · Z 1 ) =     and ZHC(G) = tr((X · Z 2m+1 ) · (X · Z 2m ) · (X · Z 2m−1 ) · · · (X · Z 2 ) · (X · Z 1 )) = 0.
We will now study the upper bound for the number of zigzagging Hamiltonian cycles.
Remark 30. For matrices X, Y ∈ M n (R + 0 ), let the coefficient K(X, Y ) be defined as K(X, Y ) = n − # zero columns in X + # zero rows in Y − # of indices i so that the X i column and Yi row are both zero .
If U B(X) and U B(Y ) are the upper bounds for elements in matrices X and Y , then is an upper bound for elements in matrix X · Y (this is a direct corollary of the definition of matrix multiplication).
Based on the frame, we get the following two types of matrices: • Tile with frame L: where a ij ≤ 4 (frame adds a factor 2 and pictures add a factor 2).
If we use the observation (5), we have two types of matrices in the product: • Tile with frame L: where a ij ≤ 4 and so U B(X · Z dL ) = 4.
We introduce two types of matrices: Remark 31. It is obvious that X · Z L is of type R 1 and X · Z dL is of type R 2 .