Journal of Graph Algorithms and Applications Exponential vs. Subexponential Tower of Hanoi Variants

We deal here with Tower of Hanoi variants played on digraphs. A major source for such variants is achieved by adding pegs and/or restricting direct moves between certain pairs of pegs. It is natural to represent a variant of this kind by a directed graph whose vertices are the pegs, and an arc from one vertex to another indicates that it is allowed to move a disk from the former peg to the latter, provided that the usual rules are not violated. We denote the number of pegs by h. For example, the variant with no restrictions on moves is represented by the Complete graph K h ; the variant in which the pegs constitute a cycle and moves are allowed only in one direction is represented by the uni-directional graph Cyclic h. For all 3-peg variants, the number of moves grows exponentially fast with n. However, for h ≥ 4 pegs, this is not the case. For example, for Cyclic h the number of moves is exponential for any h, while for a path on 4 vertices it is O(√ n3 √ 2n). This paper characterizes the graphs for which the transfer of a tower of size n of disks from a peg to another requires exponentially many moves as a function of n. To this end we introduce the notion of a shed, as a graph property. A vertex v in a strongly-connected directed graph G = (V, E) is a shed if the subgraph of G induced by V (G) − {v} contains a strongly connected subgraph on 3 or more vertices. Graphs with sheds will be shown to be much more efficient than those without sheds, for the particular domain of the Tower of Hanoi puzzle. Specifically, we show how, given a shed, we can indeed move a tower of disks from any peg to any other within O(λ n α) moves, where λ > 1 and α = 1 2 + o(1). For graphs without a shed, this is impossible.


Abstract
We deal here with Tower of Hanoi variants played on digraphs.A major source for such variants is achieved by adding pegs and/or restricting direct moves between certain pairs of pegs.It is natural to represent a variant of this kind by a directed graph whose vertices are the pegs, and an arc from one vertex to another indicates that it is allowed to move a disk from the former peg to the latter, provided that the usual rules are not violated.We denote the number of pegs by h.For example, the variant with no restrictions on moves is represented by the Complete graph K h ; the variant in which the pegs constitute a cycle and moves are allowed only in one direction is represented by the uni-directional graph Cyclic h .
For all 3-peg variants, the number of moves grows exponentially fast with n.However, for h ≥ 4 pegs, this is not the case.For example, for Cyclic h the number of moves is exponential for any h, while for a path on 4 vertices it is ).This paper characterizes the graphs for which the transfer of a tower of size n of disks from a peg to another requires exponentially many moves as a function of n.
To this end we introduce the notion of a shed, as a graph property.A vertex v in a strongly-connected directed graph G = (V, E) is a shed if the subgraph of G induced by V (G) − {v} contains a strongly connected subgraph on 3 or more vertices.Graphs with sheds will be shown to be much more efficient than those without sheds, for the particular domain of the Tower of Hanoi puzzle.Specifically, we show how, given a shed, we can indeed move a tower of disks from any peg to any other within O(λ n α ) moves, where λ > 1 and α = 1 2 + o(1).For graphs without a shed, this is impossible.

Introduction
Given are 3 pegs and a certain number n of disks of distinct sizes.Initially, the disks form a tower: the largest at the bottom of one of the pegs (the source), the second largest on top of it, and so on, until the smallest at the top of that peg.The well-known Tower of Hanoi problem asks: how do we optimally move the tower to another peg (the destination peg), subject to the following rules: 1.At each step only one disk is moved.
2. The moved disk must be a topmost one.
3. At any moment, no disk may reside on a smaller one.
We shall refer to constraints 1-3 as the Hanoi rules (HR).The puzzle was invented over a hundred years ago by Lucas [24].Ever since then, it was studied from numerous points of view.For example, in [2,3,1], algebraic properties of the solution to the Tower of Hanoi are discussed, and it is shown that the string representing the optimal solution -where the i th character denotes the disk moving at the i th step -is square-free.This line of work was extended in [4].The combinatorial aspect has been considered too (cf.[19,21]).As computer science education has evolved, the Tower of Hanoi problem has been used as a common example, demonstrating the elegance of recursive programming.The reader is referred to [35,10] for a review of the history of the problem, to [36] for an extensive bibliography of papers on various lines of research in the field and to the recent (and first!) book [18] on many of the mathematical aspects of the subject.
Many variants of the original puzzle have come up, some of which will be described here, though not chronologically.Without changing the basic peg structure (3 pegs, each pair being connected bi-directionally), one direction is solving the problem for any initial and final configurations -arrangements of disks among the pegs such that HR3 is not violated (cf.[15]).Other challenging versions have been proposed and solved in [26,27,28,29,25].In another direction, a disk may reside on top of a smaller one, with various limitations, [22,12].
Another version of the original problem is where we impose restrictions on the movements between pegs, which was discussed in several papers.In [32,35,17], the "three-in-a-row" (Path 3 ) arrangement is studied.The uni-directional cycle (Cyclic 3 ) has been solved in [5,14].It is natural to represent a variant by a directed graph.A necessary and sufficient condition for a variant (on 3 or more pegs) to be solvable, for any source and destination pegs and any number of disks, is that the corresponding graph is strongly connected [23].For 3 pegs there are 5 (up to isomorphism) strongly connected variants.A single optimal algorithm for all these variants was obtained in [31], accompanied with an explicit formula for the minimum number of moves for each variant.(Note that individual algorithms and explicit formulas were known beforehand for the common variant K 3 , for Path 3 , and for Cyclic 3 , as mentioned above.) Probably the first version with four or more pegs is "The Reve's Puzzle" [13, pp. 1−2], in which there are 4 pegs and various specific numbers of disks.It has been generalized to any number of pegs and any number of disks in [33], with solutions in [34] and [16], which were (among several other solutions) proved to be identical in [20].Analysis of the algorithms given for these problems reveals, somewhat surprisingly, that the number of moves in the solution grows subexponentially as a function of the number of disks n.In the case of 4 pegs, it grows like Θ( √ n2 √ 2n ) (cf. [35]).The lower bound issue was considered in [37] and [11], where it has been shown to grow at a rate close to that yielded by the algorithm.
Allowing four or more pegs, and imposing restrictions on whether a direct move of a disk from peg i to peg j is allowed, for each pair (i, j) of pegs, we obtain a huge number of graphs (83 non-isomorphic strongly connected digraphs on 4 vertices already), and no algorithm seems a natural candidate to be optimal.The question whether a variant is sub-exponential had been resolved only for particular ones: Star [35] (which was proved to be sub-exponential), Cyclic [7] (exponential) and Path [9] (sub-exponential; specifically, for h = 4 pegs, the number of moves grows slower than 1.6 .) The fact that, even for the original multi-peg variants on complete graphs, it is not known whether the proposed algorithms are optimal, indicates that the complexity issue for this directed-graph generalization is non-trivial.Facing the wealth of variants, we would like an easy way to determine, given a variant, whether the number of moves required grows exponentially or sub-exponentially fast.This paper presents a simple necessary and sufficient condition for a variant to be sub-exponential.In addition, it shows that • almost all graphs are sub-exponential; • the exponential graphs form a family with a concise description; and • all the sub-exponential graphs are at most "slightly worse" than K 4 and Path 4 .
In Section 2 we describe the problem domain.The main results are introduced in Section 3. The proofs of the theorems are presented in Section 4.

Problem domain and notations
Any arrangement of pegs and their immediate connections, such that each peg is reachable from each other, constitutes a variant.As mentioned above, it is natural to represent a variant by a digraph G, whose vertices are the pegs, and an arc from one vertex to another designates the ability of moving a disk from the former peg to the latter, provided that the HR are obeyed.In the rest of the paper, when we mention a variant graph, we mean a strongly connected simple directed graph (which amounts to requiring that each peg is reachable from each other) on h ≥ 3 vertices.
A configuration is a distribution of the disks among the pegs, in accordance with HR.3.A configuration is perfect if all disks reside on the same peg.Such a configuration will be denoted by R i,n , where n is the number of disks (disk 1 being the smallest and disk n the largest) and i the peg containing the disks.
Given a variant graph G and a positive integer n, the corresponding configuration graph G (n) is the graph whose vertices are all configurations of n disks over G, where there is an arc from a vertex to another if one can pass from the former to the latter by a single disk move.More generally, for any pair of configurations there is a corresponding task, of passing from the first to the second.Thus, an optimal solution of a task corresponds to a shortest path between the vertices of G (n) representing the task's initial and final configurations.The diameter of A task is perfect if both its initial and final configurations are perfect.We use the notation R i,n → R j,n both for the task and for a minimal length solution of it.The length of such a minimal solution is expressed by which we call the little diameter of G (n) .When the identity of the graph to which we refer is clear, we may omit it from this notation.For example, we may write Formally, a move is composed of the disk being moved, the peg on which it resides prior to the move, and the peg to which it is transferred.A solution to a task is a sequence of moves accomplishing it.The algorithms constructed in the proofs of our results produce solutions to all perfect tasks.
A variant graph G is H-exp if D n (G) grows exponentially fast as a function of the number of disks, namely there exist C > 0 and λ > 1 such that In principle, it could have been the case that a graph is neither H-exp nor H-subexp.However, it will follow, in particular, from Theorem 1, below, that the rate of growth of D n (G) is sufficiently regular to ensure this dichotomy.In addition, H-subexp graphs admit an explicit subexponential bound.Namely, we prove that, if

Main results
The main problem we study is how to identify, given a variant graph, whether it is H-subexp or H-exp.We start by proving that the number of moves behaves regularly as a function of the number of disks.
Theorem 1 For any variant graph G Let us recall Corollary 1 of [8]: Proposition 1 For any variant graph and any number of disks, Combining Theorem 1 and Proposition 1 one can infer Corollary 1 For every graph G and ε > 0 there exists an n 0 such that Remark 1 Corollary 1 states that d n and D n are not too far apart, justifying that it suffices to focus on d n .
The main question this paper answers is: what property must G have so that λ G = 1?To answer this, we need the following notion.
Definition 1 A shed in a strongly connected digraph G (see Fig. 1) is a vertex w with the property that the graph induced by V (G) − {w} contains a strongly connected subgraph of size at least 3. Of course, for h = 3 the graph cannot contain a shed, so such a graph is always H-exp (which is trivial anyway).
Unlike the proof of sub-exponentiality for K 4 (cf.[35]) or for the path P h [9] for h ≥ 4, the proof for general graphs containing a shed is quite cumbersome.The reason is, intuitively, that the former graphs have (at least) two sheds.This means that there are a lot more options of keeping a block of small disks on some peg for a while, taking care in the meantime of other (large) disks.On the other hand, if the graph has a single shed, then no obvious sub-exponential algorithm comes to mind, and in fact it may seem surprising at first glance that such an algorithm exists at all.
It is possible to give a very explicit description of those strongly connected graphs not containing a shed.To this end, we need Definition 2 A moderately enhanced cyclic graph (see Fig. 2) is a graph composed of a single uni-directional cycle containing all the vertices, augmented with some arcs in the reverse direction, provided that no two such arcs are adjacent.

Proofs
To prove Theorem 1, we first need Lemma 1 For every strongly connected graph G, Proof: We need to show that, for every 1 ≤ i, j ≤ h with i = j, the task R i,m+n−1 → R j,m+n−1 can be performed within at most d m d n moves.Let T m be an optimal solution for the task R i,m → R j,m , and T i ′ ,j ′ ,n with i ′ = j ′ be optimal solutions for the tasks JGAA, 20(2) 461-479 (2016) 467 Denote by T m,(l) the l-th move within T m .We are going to combine the above-mentioned solutions into a (not necessarily optimal) solution for R i,m+n−1 → R j,m+n−1 , as follows.Consider the smallest n disks 1, 2, . . ., n as a single disk − number 1 − and the largest m − 1 disks n + 1, n + 2, . . ., n + m − 1 as disks 2, 3, . . ., m, respectively.Write the solution for T i,j,m , then replace each move of disk 1 from peg i ′ to peg j ′ by T i ′ ,j ′ ,n and each move of a disk k ≥ 2 by the same move, but of disk k + n − 1.The procedure is described in Algorithm 1.
Algorithm 1 uses several pre-defined functions: DiskNumber(T m,(l) ) retrieves the disk being moved in T m,(l) .UpdateDiskNumber(T m,(l) , s) replaces the disk performing the move T m,(l) by disk s.SourcePeg(T m,(l) ) and DestinationPeg(T m,(l) ) retrieve the peg on which the disk resides prior to move l and after that move, respectively.
Since each move in T m is replaced either by T i ′ ,j ′ ,n for some (i ′ , j ′ ) (if it is a move of disk 1) or by a single move of some other disk (otherwise), the total number of moves increases at most by a factor of d n .In particular: Consequently: Proof of Theorem 1: Putting b n = ln d n+1 , we obtain by Lemma 1: The sequence (b n ) ∞ n=0 is thus sub-additive, which implies that the sequence bn n converges to its greatest lower bound (cf.[30, p. 198]), and hence so does the sequence e bn/n = n d n+1 , thus proving the theorem.
Proof of Corollary 1: Since n d n+1 (G) converges to λ G from above, for any ε > 0 and sufficiently large n In combination with Proposition 1, this proves the corollary.
To establish the proof of the 'if' part (which is the main part) of Theorem 2, we will need several definitions.Unless explicitly stated otherwise, G will denote a strongly connected graph with h ≥ 4 vertices containing a shed w, and G ′ − a strongly connected subgraph of size at least 3 of the graph left after w is removed.(Note that G may contain more than one shed, and for each choice of a shed there may be several appropriate strongly connected subgraphs of G.For our purposes, though, any choice of a shed vertex and a strongly connected component in accordance with that shed is suitable.)Taking a shortest path from w ∈ V (G) − V (G ′ ) to V (G ′ ), we denote the entrance vertex to G ′ − the last vertex on this path and the only one that belongs to G ′ − by e.Similarly, an exit vertex x ∈ V (G ′ ) is the first vertex on a shortest path leading from V (G ′ ) to w.These paths will be denoted by p w,e and p x,w , respectively.The sequence of moves of disk r along, say, the path p w,e is expressed by t w,e,r .S (l) is the l-th move in a sequence of moves S.
Example 1 In each of the graphs G 1 and G 2 in Figure 1, vertex w = 4 is a shed.(In fact, in G 2 all vertices but 2 and 3 are sheds.)For G 1 we have e = x = 1, whereas for G 2 we have e = 2, x = 3.
As hinted above, most of the work is required for the 'if' part of Theorem 2.
The following lemma shows that some of the tasks are of sub-exponential complexity.Let Inner = V (G ′ )−{e, x}.We first show that tasks in which the source is the shed and the destination lies in Inner (or vice versa) are sub-exponential.

Lemma 2 Let G, G
′ , w be as above and v ∈ Inner.Then |R w,n → R v,n | and |R v,n → R w,n | grow sub-exponentially fast as functions of n.

JGAA, 20(2) 461-479 (2016) 469
Proof: Fix a number λ ≥ λ G ′ .It suffices to show that for some α < 1 there exists a constant C such that In fact, we will show that this is the case for every α > 1 2 .The proof is based on the procedures ShedToInner (Algorithm 2) and InnerToShed (Algorithm 3), which perform, respectively, the tasks and moves.We discuss ShedToInner in detail.For each i, j ∈ V (G ′ ) we choose a simple path from i to j.The sequence of moves of a single disk r (henceforth transfer) along this path is denoted by t i,j,r .A sequence of moves joining a single disk r, currently on peg i, to the set of disks {m + 1, . . ., r − 1}, currently on peg j, utilizing only the subgraph G ′ , is produced by Accumulate(i, j, r, m + 1 . ..r − 1) (detailed in Algorithm 4), provided that there are no other disks in G ′ .The algorithm ShedToInner(w, v, n) splits the disks into two sets.One is that of the smaller disks − {1, 2, . . ., m}, where m = ⌈n − n α ⌉, which will be repeatedly moved between the shed and vertex v.The other set − {m + 1, m + 2, . . ., n} − is that of the larger ones, that will be accumulated one by one on vertex v.At the beginning, the smallest m disks are moved (recursively) to vertex v, revealing the larger ones.Then the algorithm performs n−m iterations, in each of which the next disk from the set {m + 1, m + 2, . . ., n} is handled.We enumerate the first iteration by m + 1, the second by m + 2, and so on.Immediately prior to iteration r, m < r ≤ n, disks 1, 2, . . ., m, m + 1, . . ., r − 1 are at vertex v, and disks r, r + 1, . . ., n are at the shed vertex, w.In iteration r: • Disk r (whose transfer is the goal of the iteration) is temporarily moved to vertex e.
• The smallest m disks are moved from vertex v to the shed.
• The smallest m disks are returned from the shed to vertex v.
By the end of the iteration, disks 1, 2, . . ., m, m + 1, . . ., r are at v, while the larger disks, r + 1, . . ., n, are still at the shed.Principally, Algorithm InnerToShed works in a similar way.It splits the disks into the set of the smaller disks − {1, 2, . . ., m}, where m = ⌈n − n α ⌉, which will be repeatedly moved between vertex v and the shed.The other set − {m + 1, m + 2, . . ., n} − is that of the larger disks, that will be accumulated one by one on the shed.The procedure Split serves as the opposite to Accumulate.
The procedure Accumulate is detailed in Algorithm 4. The procedure MoveInG ′ (i, j, D) moves a set of disks D from vertex i to j, using G ′ only.The call MoveInG ′ (v, e, m+1 . . .r−1) moves the tower consisting of disks m + 1, . . ., r − 1 from v to e.The call MoveInG ′ (e, v, m + 1 . . .r) performs an analogous task (from e to v, with the additional disk).Thus, by Corollary 1, the number of moves produced by the (r − m)-th invocation of Accumulate is bounded above by C ′ λ r−m , for some constant C ′ = C ′ (G ′ ).(In fact, Algorithm 4 is not necessarily the most efficient way to perform the accumulation, but it suffices for our needs.)Algorithm 4 Accumulate(e, v, r, m + 1 . . .r − 1) /* Starting with disks m + 1 . . .r − 1 on peg v and disk r on peg e, the algorithm */ /* unites them so that all disks will reside on peg v, using Since each step carried out by ShedToInner, Accumulate and MoveInG ′ obeys the HR, and at the end all disks reside on vertex v, the correctness of the algorithms is straightforward.
Inequalities ( 1) and ( 2) are proved simultaneously by induction on n, where the constant C will be determined later.Since f w,v (1) ≤ h − 1 and f v,w (1) ≤ h − 1, both inequalities are valid for n = 1 provided C ≥ h − 1. Assume that (1) and ( 2) hold with n replaced by every smaller number.For simplicity, we consider f w,v (consideration of f v,w is analogous) for the case of n disks.Algorithm 2 makes: • n − m calls to InnerToShed(w, v, m), • n − m transfers of a single disk along a simple path in G, and • n−m calls to Accumulate(e, v, r, m+1 . ..r−1), for r = m+1, m+2, . . ., n.
Since m = ⌈n − n α ⌉, we have where )), and hence where we assume that C > C ′′ .This completes the proof of (1).The proof of ( 2) is analogous.The following lemma is required for the proof of the 'only if' part of Theorem 2.
Lemma 3 There exists a constant C with the following property.For every graph G, not containing a strongly connected component of size 3 or more, and for any initial configuration, the number of different disks which can participate in any legal sequence of moves is bounded above by Ch (where the constant C is sufficiently large; see below).Consider the first move of the disk residing at the l-th place (counting from the top) of peg i before T is started.Right before this move, all smaller disks (residing on peg i prior to T ) have to be spread on h − 2 of the other pegs, making it necessary for at least one peg to accept more than Ch Proof of Theorem 2: (a) Here we prove the 'if' part of the theorem.Let G ′ , w, e, x be as before.Take λ > λ G ′ .We will show that, if α > 1  2 is arbitrarily fixed, then for every pair of vertices i, j ∈ V (G), there exists a constant K such that Take v ∈ V (G ′ ) − {e, x}.Due to Lemma 2, it remains to consider the following cases: • Case 4: i, j ∈ V (G), where at least one of i, j does not belong to V (G ′ ) ∪ {w}.
Remark 2 In fact, there is some overlap between the cases.For example, in Case 1 we need only to take care of the case where j = e, and in Case 2 only of i = x, but this is of no consequence.• Moves all the disks from the shed to vertex v.
• Moves all disks but the largest in the set from v back to the shed.
• Moves the largest disk from vertex v to the destination.Remark 3 Setting the set of largest disks to contain more than one disk at a time, we could get a more efficient algorithm; however, for our purpose, this algorithm suffices.
The procedures ShedToInner and InnerToShed are as in the proof of Lemma 2. Algorithm 5 provides the details.
T ← T * t v,j,r end for T ← T * t w,j,1 end if return T If a single disk can be moved uninterruptedly from a vertex to another, the number of moves is less than h.This is the situation whenever the t v,j,r is performed (disk r is moved along a simple path from v to j, where these two vertices are in G ′ and all other disks currently in G ′ are larger than r).
ShedToInner(w, v, n) and InnerToShed(w, v, n) require at most Cλ n α moves each, for an appropriate C. We now bound the number of moves f w,j (n) performed by ShedToG ′ (w, j, n): Case 2: We employ G ′ ToShed, which moves a tower of n disks from any vertex i ∈ V (G ′ ) − {v} to the shed.Clearly: as for f w,j .
a n = d i,j,n for n ≥ 1.We shall show that Let S n+1 be an optimal solution for the task R i,n+1 → R j,n+1 , and l(S n+1 ) its length.Divide S n+1 into consecutive subsequences of length b + 1 (and a remainder of length at most b at the end).Define two operations on such sequences: (1) Drop: Remove all moves of disk 1.
(2) Decr: Decrement the disk number in each move by 1.
Starting with a sequence involving disks 1, 2, . . ., n + 1, and applying Drop and then Decr to it, we arrive at a sequence involving disks 1, 2, . . ., n.Moreover, applying Drop and then Decr to S n+1 , we obtain a (not necessarily optimal) solution S n for R i,n → R j,n , where each previous subsequence of length b + 1 shrank to length at most b.Since l(S n+1 ) = a n+1 and l(S n ) ≥ a n , this yields It is straightforward to show that G ec ⊆ G ns .For the direction G ns ⊆ G ec , let G ∈ G ns .Distinguish between two cases.
• Case 1: G is (strictly) directed: There are two vertices i, j in G such that (i, j) ∈ E(G) but (j, i) ∈ / E(G).
Since G is strongly connected, there is a path from j to i.The path has to pass through at least one vertex in V (G)− {i, j}, say k.Clearly, the graph induced by {i, j, k} and the other vertices along the path from j to i is strongly connected with at least 3 vertices.The graph is actually G itself.Indeed, had there been a vertex not included in it, that vertex would be a shed -contradicting the 'shedlessness' of G.This path, together with the arc from i to j, constitutes the (only) main cycle in G. Obviously, there are no two consecutive back arcs along this cycle; if there were such arcs between, say, {i ′ , j ′ , k ′ }, all other vertices would have been sheds.
• Case 2: The graph is undirected.
Take any two adjacent vertices i, j.Since G is strongly connected, there is at least one vertex k, adjacent, say, to j.The subgraph induced by {i, j, k} is strongly connected.All other vertices of G are sheds, contradicting the assumption that G ∈ G ns .
This completes the proof of the proposition.

Figure 1 :
Figure 1: Two graphs with sheds A non moderately enhanced cyclic graph (since it has two consecutive back arcs) (b) A moderately enhanced cyclic graph

Figure 2 :
Figure 2: A moderately enhanced cyclic graph and a graph with a shed

Algorithm 1
Combine() /* Combining existing solutions with m and n disks to obtain a solution */ /* with m + n − 1 disks.The symbol '*' stands for concatenation.*/ T m+n−1 ← [ ] /* The empty sequence */ /* Producing the required solutions with m and n disks.*/ T

Algorithm 2
ShedToInner(w, v, n) /* The algorithm moves a tower of n disks from the shed w to a vertex v ∈ V (G ′ ) − {e, x}, where G ′ , e and x are defined following the proof of Corollary 1. */ if n ≥ 1 then m ← ⌈n − n α ⌉ T ← ShedToInner(w, v, m) for r ← m + 1 to n do T ← T * t w,e,r T ← T * InnerToShed(w, v, m) T ← T * Accumulate(e, v, r, m + 1 . . .r − 1) T ← T * ShedToInner(w, v, m) end for end if return T

1 2 1 2
lg h disks from peg i, contradicting [6, Theorem 1.3] if C is sufficiently large.It follows that the overall number of disks that can participate in any task is bounded above by h(h − 2)Ch lg h + 2h, proving the lemma.

Case 1 :
We employ ShedToG ′ (w, j, n) (Algorithm 5), which moves a tower of n disks from the shed to any vertex j ∈ V (G ′ ) − {v}.In order to place the next largest disk at the destination, it performs the following: JGAA, 20(2) 461-479 (2016) 473

Algorithm 5
ShedToG′ (w, j, n) /* The algorithm moves a tower of n disks from the shed w to any j ∈

,
a n ≤ l(S n ) ≤ l(S n+1 )thus completing the proof of this part.Proof ofProposition 2: Denote by G ns the family of graphs on h ≥ 4 vertices which do not have a shed, and by G ec the family of moderately enhanced cyclic graphs (see Fig. 2.(b)).Recall that a moderately enhanced cyclic graph is composed of a uni-directional cycle (henceforth the main cycle) of all vertices, augmented perhaps by up to h 2 non-adjacent arcs in the reverse direction (henceforth back arcs).