A fast algorithm on average for solving the Hamilton Cycle problem

11/29/2021
by   Michael Anastos, et al.
Freie Universität Berlin
0

We present CertifyHAM, an algorithm which takes as input a graph G and either finds a Hamilton cycle of G or it outputs that such a cycle does not exists. If G=G(n, p) and p >2000/n then the expected running time of CertifyHAM is O(n/p). This improves upon previous results due to Gurevich and Shelah, Thomason and Alon and Krivelevich.

READ FULL TEXT VIEW PDF

Authors

page 1

page 2

page 3

page 4

11/29/2021

Fast algorithms for solving the Hamilton Cycle problem with high probability

We study the Hamilton cycle problem with input a random graph G=G(n,p) i...
04/13/2020

Exact and Approximate Algorithms for Computing a Second Hamiltonian Cycle

In this paper we consider the following total functional problem: Given ...
08/07/2020

A 2^O(k)n algorithm for k-cycle in minor-closed graph families

Let 𝒞 be a proper minor-closed family of graphs. We present a randomized...
10/26/2020

Deep reinforced learning enables solving discrete-choice life cycle models to analyze social security reforms

Discrete-choice life cycle models can be used to, e.g., estimate how soc...
12/22/2015

Facility Deployment Decisions through Warp Optimizaton of Regressed Gaussian Processes

A method for quickly determining deployment schedules that meet a given ...
04/21/2021

The 1-1 algorithm for Travelling Salesman Problem

The Travelling Salesman Problem (TSP), finding a minimal weighted Hamilt...
08/20/2020

Fast recognition of some parametric graph families

We identify all [1, λ, 8]-cycle regular I-graphs and all [1, λ, 8]-cycle...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

A Hamilton cycle in a graph is a cycle that visits every vertex exactly ones. We say that a graph is Hamiltonian if it contains a Hamilton cycle. The Hamilton cycle problem, which we denoted by HAM, asks to determines whether a given graph has a Hamilton cycle; it belongs to the list of Karp’s 21 NP-complete problems [13] and if then there does not exist an algorithm that determines the Hamiltonicity of in time for every graph on vertices. The fastest deterministic algorithm known today that solves HAM is the Held–Karp algorithm, also called Bellman–Held–Karp algorithm [6],[12]; it is a dynamic programming algorithm with worst-case time complexity time and worst-case space complexity .

In [11], Gurevich and Shelah gave an algorithm that determines the Hamiltonicity of an -vertex graph in polynomial time on average. Equivalently, as is the uniform measure over all graph on vertices, the expected running time of their algorithm over the input distribution is polynomial in when . The last statement raises the question for which values of there exists an algorithm that solves HAM in polynomial expected running time over the input distribution . Gurevich and Shelah [11], Thomason [18] and Alon and Krivelevich [1] gave such an algorithm for being constant, and respectively.

In this paper we introduce CertifyHAM, a deterministic algorithm that solves HAM. Our main result is the following.

Theorem 1.1.

CertifyHAM solves HAM in expected running time over the input distribution for .

In the above Theorem we assume that we are given , the adjacency matrix of , and that each entry of can be accessed in time. Observe that any algorithm that solves HAM has to identify at least edges of ; hence w.h.p.111We say that a sequence of events

holds with high probability (w.h.p. in short) if

. it has to read at least entries of . Thus the expected running time of CertifyHAM is optimal.

One of the most interesting figures of Theorem 1.1 is that it can also deal with below the Hamiltonicity threshold. A cerebrated result of Bollobás [8] and of Komlós and Szemerédi [14] state that the threshold for Hamiltonicity is the same as the threshold for minimum degree 2 in the model and it is equal to . For a complete survey on the Hamilton Cycles in random graphs see [10].

Theorem 1.1 falls into the area of average-case analysis of algorithms. For a complete survey on this area see [7]. It is motivated by the idea that the worst-time complexity of an algorithm is usually based on some well orchestrated instance and such instances are atypical. Thus the average time complexity may be a better measure of the performance of an algorithm. In addition using algorithms that run fast on average is one way to cope with NP-hard problems.

A distributional problem is a pair where is a decision problem and where

is a probability distribution on the inputs of

of size . We say that a distributional problem belongs to if there exists an algorithm (with running time for an instance of ), a constant and a polynomial with the property that

Let . Theorem 1.1 and the upper bound on given in Lemma 2.9, give the following.

Corollary 1.2.

belongs to for all .

1.1 Description of CertifyHAM

CertifyHAM impliments 2 algorithms. First it implements CerHam1. CerHam1 solves with input in time with probability . In addition, if then CerHam1 returns “ in not Hamiltonian”. If CerHam1 fails to solve HAM for a given instance then CertifyHAM implements CerHam2 whose expected run time of CerHam2 is . For an instance denote by and the running time with input of CerHam1, CerHam2 and CertifyHam respectively. Then, for ,

The description of CerHam1 is given in [4]. In this paper we introduce and analyse CerHam2.

CerHam2 takes as an input a graph and starts by querying a number of edges of . By querying an edge of we refer to reading the corresponding entry of the adjacency matrix of . When we consider that initially all of the entries of are blank. Once we query an edge of we reveal whether the edge belongs to , equivalently whether the corresponding entry of is filled with 0 or 1. As the corresponding entry is equal to 1 independently of all the entries that we have revealed so far.

Once CerHam2 has made its initial queries it proceeds and iterates over a while loop. Each iteration starts with a full path packing of and a set . A full path packing of is a set of vertex disjoint paths in that cover . Here we consider single vertices to be paths of length 0. Thus has at least 1 full path packing, namely the one that consists of the paths of length 0. Then the algorithm adds to a set of edges that join the paths in into a Hamilton path. It continues by performing sequences of restricted Pósa rotations, defined in Section 2, and identifies sets , such that for every and there exists a Hamilton path in from to . Now either (I) all of the sets are large or (II) at least one of them is small. In the first case it identifies and queries an edge with and that has not been queried yet. If then it updates to a full path packing of size 1 less or claims that is Hamiltonian; in such a case we say it improves on . In the unlikely event that (II) occurs and one of the sets , is small then it adds this set to , along with possibly some other sets. It then attempts to pack paths in such that every vertex in is in the interior of some path. If no such path packing exists then it outputs “ is not Hamiltonian”. If such a path packing does exists then it adjust such that it contains as a subset. The algorithm exits the while-loop if gets too large or too many attempts to improve have been taken place. In the unlikely event that the CerHam2 exits its while loop it implements the Held-Karp algorithm.

The rest of the paper is organised as follows. In Section 2 we present the tools needed for the presentation and analysis of CerHam2. We then present and analyse CerHam2 in Section 3. Its analysis is split into 3 cases corresponding to the regimes , and respectively. For ease of the presentation of the paper we have moved the proofs of technical results to the Appendix.

2 Preliminaries

2.1 Restricted Pósa Rotations

Given a Hamilton path and , we say that the path is obtained from via a Pósa rotation that fixes . We call and the pivot vertex and the new endpoint respectively. We call and the inserted and the deleted edge respectively. We will not perform all Pósa rotations possible. Instead we will only perform Pósa rotations for which the pivot vertex does not belong to some prescribed set . The exact procedure which we call follows shortly. It takes as an input a graph , a Hamilton path of with endpoints and a set not containing . It then outputs sets and such that for each there exists a Hamilton path in from to .

1:Let , , .
2:while  do
3:      Let be the first vertex in and be the unique Hamilton path in from to .
4:      For perform the Pósa rotation starting from that fixes and the inserted edge is only if the new endpoint does not belong to . If the Pósa rotation is performed then add the new endpoint to and to the end of and the corresponding path to .
5:      Remove from .
6:end while
7:Output .
Algorithm 1

As every vertex enters at most once the set , both have size at most throughout the above algorithm which runs in time.

We replace the classical Pósa Lemma with the first part of the following one.

Lemma 2.1.

Let be a graph, , a Hamiltonian path of with endpoints and . Then,

Proof.

Let be the vertices in in the order that are added to and be the corresponding Hamiltonian paths. Let and for , where is the deleted edge in the Pósa rotation that results to the Hamilton path for and is the vertex preceding on for .

Now let and . If a Pósa rotation occurs with being the deleted edge then for some . Else the vertex that succeeds on is for some . In this case let be the sequence of paths in that correspond to the Pósa rotations that transform to . Then at every path of this sequence an edge incident to is either equal to or is an inserting edge. In both cases, both of the endpoints of belong to hence . Therefore and

The key advantage of performing restricted Pósa rotations as opposed to normal Pósa rotations is given by the following observation.

Observation 2.2.

If and then and are disjoint. Indeed . Thereafter for a vertex only a Pósa rotation with a pivot vertex in may result to a path with as an endpoint. As for we have that no vertex in ever enters .

Observation 2.3.

If then the set is connected in .

We use as a subroutine in the algorithm stated below. takes as an input a full path packing . It then performs and outputs sets , and a set of full path packings with the following property. For and there exists a full path packing of size at most with the property that adding to creates a Hamilton cycle if or joints two paths in and creates a full path packing of size at most .

1:Let . Let be the endpoints of , .
2:Let and .
3:
4:for  do
5:      Let be the Hamilton path from to in .
6:      .
7:      For let be the - Hamilton path in and let be the full path packing obtained from by removing the edges in .
8:end for
9:Set
10:Output .
Algorithm 2

calls O(n) times, hence its running time is .

2.2 Covering non-expanding sets

In this subsection we introduce which is the subroutine that we will use to deal with “problematic sets”. These sets will be non (sufficiently) expanding and will contain small sets outputted by . takes as an input a graph , a set of size less than and a full path packing and tries to adjust so that every vertex in is found in the interior of some path in . It starts by implementing the Held-Karp algorithm to find a path packing that covers . It then adjusts so that it contains .

1:Let be the subgraph of induced by .
2:for  every component of of  do
3:      Add to every edge spanned by and let be the obtained graph.
4:      Implement Held-Karp to find a Hamilton cycle of . If no such a cycle exists output “ is not Hamiltonian”.
5:      Remove from all the edges not incident to let be the set of paths left of length at least 1.
6:      Remove from the paths in the vertices that are covered by and add to .
7:end for
8:Output .
Algorithm 3

The correctness of line 4 of the above algorithm is given by the following Lemma.

Lemma 2.4.

Let and be such that and each vertex in has the same neighborhood in both and . Then if CoverAndAdjust() outputs “ is not Hamiltonian” then is not Hamiltonian.

Proof.

Assume that has a Hamilton cycle and let be an arbitrary component of . Then, as the edges of incident to induce a path packing that cover such that the endpoints of lie in for . As each vertex in has the same neighborhood in both and these paths are present in , hence in . Finally as every pair of vertices in forms an edge in the paths can be used to form a Hamilton cycle in . Thus CoverAndAdjust() does not outputs “ is not Hamiltonian”. ∎

Observation 2.5.

After the execution of may increase by at most . This is because the “new” paths cover at most vertices and for each vertex covered by a new path at most 2 edges may be deleted at line 6.

The running time of ) is dominated by the application of Held-Karp algorithm and it is where is the size of the largest component of the subgraph of induced by .

2.3 A Family of Pseudorandom Graphs

Initially CerHam2 queries the edges of that belong to some graph . is constructed by taking a -regular pseudorandom graph on at least and at most vertices, then taking the subgraph of induced by a subset of of size and finally adding a number of edges incident to vertices of small degree. The construction of as well as the proof of the Lemma that follows is given in Appendix A.

Lemma 2.6.

For significantly large there exists a graph on that can be constructed in time and satisfies the following.

  • For every pair of disjoint sets the number of edges spanned by is at least and at most

  • has minimum degree .

  • At most vertices in have degree larger than in .

2.4 A coloring process

For a graph we let be the graph on with edge set . At the regimes where we first implement the following red/blue/black coloring coloring procedure: Initially all the vertices of are coloured black. While there exists a blue or black vertex with at most black neighbors in recolor red and the black neighbors of blue.

We denote by , and the sets of vertices that their final color given by the above procedure is red, blue and black respectively. A standard argument shows that , and do not depend on the order in which the vertices are being processed (see [3]). Observe that every vertex in both and has at least neighbors in . The motivation of the above procedure is to separate the sparse (red) portion of the graph from the dense one (black) by a cut (blue) while ensuring that the vertices in the cut are robustly connected to the dense part. In our analysis, for the sparse regimes, we use this decomposition and take advantage of the following observation and lemma. For the proof of Lemma 2.8 see Appendix A.

Observation 2.7.

During the above coloring process every time a vertex is colored red at most 5 other vertices are colored blue. Thus, for every component of the subgraph of induced by we have that .

Lemma 2.8.

Let and . For define the following events,

there exists a set of size at most with the property

and

there exists a set of size at most and a subgraph of

Then, for , and the following hold.

(1)
(2)

2.5 Minimum degree 2

De facto if does not have minimum degree 2 then is not Hamiltonian. Such a feature can be detected in time. In the event that we can initiate CerHam2 by implementing an algorithm for prepossessing that runs in time inversely proportional to . Thus it becomes crucial to upper bound . This is done in the following Lemma. Its proof can be found at Appendix A.

Lemma 2.9.

Let and . Then,

(3)

3 Certifying Hamiltonicity

CerHam2 takes as input a graph on and two sets . It also utilizes the graph whose construction is given in Appendix A. Throughout its execution consists of the edges of that have been queried so far and is the subgraph of with edge set the edges in that belong to .

1:Set , , , and .
2:Query the edges in and set .
3:while  and  do
4:      .      
5:     if  there exists such that  then
6:          Let .
7:          While there exists s.t. and and is connected in , add to .
8:          Add to all the edges incident to and query the edges of that have just been added to . Add any edges of that have just been revealed to .
9:          Execute . If it outputs “ is not Hamiltonian” then output “ is not Hamiltonian”. Else let .
10:         Set .
11:     else
12:          Let and be such that .
13:          Add to and query whether .
14:          Set .
15:         if   then let be a full path packing in such that none of lies in the interior of a path in . Add to the graph spanned by the paths in the edge . If it spans a Hamilton cycle output “ is Hamiltonian”. Else let be the induced full path-packing. Add to .
16:         end if
17:     end if
18:end while
19:Set .
20:Reveal .
21:Execute the Held-Harp algorithm with input the graph .
Algorithm 4 CerHam2(G,K,S)

For the correctness of CerHam2 one has to verify the correctness of lines 9 and 12. If CerHam2 outputs “ is not Hamiltonian” at line 9 then this statement is indeed true due to Lemma 2.4; here we are using that we reveal all the edges in incident to at line 8 and hence the edge sets incident to in and are identical. For line 12 recall that Observation 2.2 implies that at every iteration of the while-loop the sets and disjoint from . In addition observe that is an upper bound on the number of edges in not incident to . Furthermore Lemma 2.6 states that at most vertices have degree larger than in . Therefore if the algorithm proceeds to line 12 then the set contains at least edges and the corresponding choice of and is possible.

Let for . The following lemma upper bounds the number of edges in we need to identify at line 13. We later use Lemma 3.1 to upper bound the probability that at the end of the while-loop. For let if the time line 13 is executed an edge in is identified.

Lemma 3.1.

For we have,

(4)

Furthermore,

(5)

In addition, if then for ,

(6)

Finally, if CerHam2 exits the while-loop and then,

(7)
Proof.

Let and let be the sets added to , due to lines 6 and 7, in the order that they were added, to form . As throughout the algorithm is a supergraph of , with , we have,

For the proof of (6) we repeat the above argument with being the sets added to to form .

Now observe that due to line 7 of the algorithm we have that . Therefore,

for . Hence .

If CerHam2 exits the while-loop and then the line 14 has been executed times. Say if a Hamilton cycle has been constructed. The time line 9 is executed the number of paths in may be increased by at most (see Observation 2.5). On the other hand implies a decrease in the time line 13 is executed. If CerHam2 exits the while-loop then throughout the algorithm and as initially we have,

3.1 The upper range

Let and . We execute CerHam2() with . For the analysis of this regime we define the following events.

and

Lemma 3.2.

If

(8)

then the expected running time of CerHam2 is .

Proof.

Lemma 3.1 implies that and therefore CerHam2 may execute at most times line 4. Each execution of line 4 runs in time; hence line 4 takes in total time. This is also the running time of CerHam2 in the event that it never proceeds to line 6 and it does not exit the while-loop.

In the event the algorithm may exit the while loop. Before exiting the while loop it may reach line 5 at most times, each time spending at most time at lines 5 to 9. After exiting the while-loop it executes Held-Karp whose complexity is . Thus, in the event CerHam2 runs in time.

On the other hand, if none of , occurs then for and . The inequality follows from the fact that while the algorithm will not search for larger sets to add to at line 7 and it will never add to it a set of size larger than at line 6. Thus if a set is added by CerHam to then and . In addition, by Lemma 3.1, and hence and and as does not occur we have that

Thus, if none of , occurs and we let then and the event occurs. In the event CerHam2 may execute lines 6-10 at most times each running in time yielding a total running time for lines 6-10 of .

Equation (8) follows from the fact that at least one of the events occurs. ∎

Lemma 3.3.

Equation (8) holds.

Proof.

In the event we can find disjoint sets of size and such that no edge from to belongs to . Thus,

In the event (7) implies that . For , with probability independently of . Thus,

Finally, for , in the event