A distributed algorithm for finding Hamiltonian cycles in random graphs in time
Introduction
Surprisingly few distributed algorithms have been designed and analyzed for random graphs. To the best of our knowledge the only work dedicated to the analysis of distributed algorithms for random graphs is [1], [2], [3]. This is rather surprising considering the profound knowledge about the structure of random graphs available since decades [4], [5]. While algorithms designed for general graphs obviously can be used for random graphs the specific structure of random graphs often allows to prove asymptotic bounds that are far better. In the classical Erdős and Rényi model for random graphs a graph is an undirected graph with n nodes where each edge independently exists with probability p [6]. The complexity of algorithms for random graphs often depends on p, e.g., Krzywdziński et al. [2] proposed a distributed algorithm that finds w.h.p. a coloring of with colors in rounds.
In this work we focus on finding Hamiltonian cycles in random graphs. The decision problem, whether a graph contains a Hamiltonian cycle, is NP-complete. In contrast to problems such as coloring or maximal independent set it is a non-local graph problem, i.e., it is required to always consider the entire graph in order to solve the problem. It is impossible to solve it in the local neighborhoods. For this reason there is almost no work on distributed algorithms for finding Hamiltonian cycles in general graphs. On the other hand it is well known that contains w.h.p. a Hamiltonian cycle, provided , where satisfies [4, Th. 8.9]. There is a large body of work on sequential algorithms for computing w.h.p. a Hamiltonian cycle in a random graph (e.g. [7], [8], [9], [10], [11]).
We are aware of two distributed algorithms for computing Hamiltonian cycles in random graphs. The algorithm by Levy et al. [1] outputs w.h.p. a Hamiltonian cycle provided . This algorithm works in synchronous systems, terminates in linear worst-case number of rounds, requires rounds on expectation, and uses space per node. The algorithm of Chatterjee et al. [3] works for () and has a run time of . An algorithm based on a transformation scheme is discussed below [12].
The search for a distributed algorithm for a Hamiltonian cycle is motivated by the usage of virtual rings for routing in wireless networks [13], [14]. A virtual ring is a directed closed path involving each node of the graph, possibly several times. Virtual rings enable routing with constant space routing tables, messages are simply forwarded along the ring. The downside is that they may incur a linear path stretch. To attenuate this, distributed algorithms for finding short virtual rings have been proposed [15], [14]. Hamiltonian cycles are the shortest possible virtual rings and therefore of great interest. Short virtual rings are also of interest for all token circulation techniques as discussed in [16]. Kim et al. discuss the application of random Hamiltonian cycles for peer-to-peer streaming [17]. Rabbat et al. present distributed optimization algorithms for in-network data processing, aimed at reducing the amount of energy and bandwidth used for communication based on Hamiltonian cycles [18].
This paper uses the synchronous model, i.e., each message contains at most bits. Furthermore, each node has only bits of local memory. Without these two assumptions there is a very simple solution provided the nodes have unique identifiers. First a BFS-tree rooted in a node is constructed. Then the adjacency list of each node is convergecasted to which applies a sequential algorithm to compute w.h.p. a Hamiltonian path (see Sec. 1.1). The result is broadcasted into the graph and thus each node knows its neighbor in the Hamiltonian cycle. This can be achieved in rounds. Note that if then w.h.p. [19], [5]. In particular for p in w.h.p. the diameter of is constant [20].
For the stated restrictions on message size and local storage we propose an algorithm that terminates in a logarithmic number of rounds, this is a significant improvement over previous work [1], [3]. Our contribution is the distributed algorithm , its properties can be summarized as follows.
Theorem 1 Let with be a random graph. Algorithm computes in the synchronous model w.h.p. a Hamiltonian cycle for G using messages of size . terminates in rounds and uses memory per node.
Pósa showed already in 1976 that almost all random graphs with edges possess a Hamiltonian cycle [7]. Later Komlós et al. determined the precise threshold for the existence of a Hamiltonian cycle in a random graph [21]. A sequential deterministic algorithm that works w.h.p. at this threshold requiring time is due to Bollobás et al. [10]. For larger values of p or restrictions on the minimal node degree, more efficient algorithms are known [8], [22]. The algorithm of Thomason finds a Hamiltonian path or shows that no such path exists provided [11].
The above cited algorithms were all designed for the sequential computing model. Some exact algorithms for finding Hamiltonian cycles in on parallel computers using the CRCW-PRAM model have been proposed [23], [24]. The first uses processors and expected time provided for some large enough constant c. MacKenzie and Stout proposed an algorithm that operates in expected time and requires processors provided p is constant [24]. Apart from the above mentioned work [1], [3] we are aware of only one other distributed algorithm for this problem. Ghaffari and Li proposed a general transformation that simulates any work-efficient PRAM algorithm running on a graph G in T parallel rounds via a distributed algorithm running in rounds in the model [12]. Applying their transformation to the algorithm of Coppersmith [23] they show the existence of a distributed algorithm that finds in rounds w.h.p. a Hamiltonian cycle of provided that for some large enough constant C. Besides the fact that the transformed algorithm may be difficult to implement it also has a worse time complexity compared to the proposal of this paper.
There are several approaches to construct a Hamiltonian cycle. The approach used by Levy et al. at least goes back to the work of MacKenzie and Stout [24]. They initially construct a small cycle with nodes. As many as possible of the remaining nodes are assorted in parallel into vertex-disjoint paths. During the final phase, each path and each non-covered vertex are patched into the initial cycle.
The second approach is used in the proofs to establish the critical value (e.g., [7], [25]) and all derived sequential algorithms (e.g., [10]). Initially a preferably long path is constructed, e.g., using a depth first search algorithm [22]. This path is extended as long as the node at the head of the path has a neighbor that is not yet on the path. Then the path is rotated until it can be extended again. A rotation of the path cuts off a subpath beginning at the head, reverses the order of the subpath's nodes, and reattaches the subpath again. The procedure stops when no sequence of rotations leads to an extendable path. The algorithm in [3] follows this approach.
Section snippets
Computational model and assumptions
This work employs the synchronous model of the distributed message passing model [26], i.e., each message contains at most bits. Furthermore, each node has only bits of local memory. The communication network is represented by an undirected graph , where V is a set of n processors (nodes) and E represents the set of m bidirectional communication links (edges) between them. Each node carries a unique identifier. Communication between nodes is performed in
Informal description of algorithm
Algorithm operates in sequential phases, each of them succeeds w.h.p. The first two phases last rounds. Each subsequent phase requires a constant number of rounds only. Phase 0 lasts rounds and constructs a path P of length starting in . In the next rounds Phase 1 closes P into a cycle C of length at most . The following phases are called the middle phases. In each of those phases the number of nodes in C is increased. The increase is by a
Formal description
Algorithm operates in synchronous rounds. By counting the rounds a node is always aware in which round and therefore also in which phase it is. Each phase lasts a known fixed number of rounds. If the work is completed earlier, the network is idle for the remaining rounds of the phase. Algorithm gradually builds an oriented cycle C starting with node . The cycle is maintained as a doubly linked list to support insertions. The orientation of C is administered with the help of variable
Analysis of algorithm
This section proves the correctness and analyzes the complexity of the individual phases and proves the main theorem. First, we prove that produces the numbering that guarantees that the final phases work correctly. Afterwards the individual phases are analyzed. Some of the results are proved for values of p less than to make them more general.
Lemma 2 At the end of each phase each node has a different number provided . Furthermore, the numbers are ascending beginning with 0 for node
Proof of Theorem 1
The pre-processing phase lasts 9 rounds. By Lemma 3, Lemma 5 phases 0 and 1 terminate after rounds w.h.p. with a cycle with at most nodes. Each middle phase lasts a constant number of rounds. According to Lemma 9 after at middle phases the cycle C has w.h.p. nodes and by Lemma 12 after another middle phases w.h.p. nodes. Then in final phases, each lasting a constant number of rounds, C is w.h.p. a Hamiltonian cycle by Lemma 13. This leads to the
Conclusion
This paper presented an efficient distributed algorithm to compute in rounds w.h.p. a Hamiltonian cycle for a random graph provided . This constitutes a large improvement over the state of the art with respect to () and run time . It is well known that contains w.h.p. a Hamiltonian cycle, provided . There is a large gap between and . It appears that by maxing out the arguments of this paper it is possible to
Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Acknowledgements
This work is supported by the Deutsche Forschungsgemeinschaft (DFG) under grant DFG TU 221/6-3. The author is grateful to the reviewers' valuable comments that improved the manuscript.
References (27)
- et al.
A distributed algorithm to find Hamiltonian cycles in random graphs
- et al.
Distributed algorithms for random graphs
Theor. Comput. Sci.
(2015) - et al.
Fast and efficient distributed computation of Hamiltonian cycles in random graphs
Random Graphs
(2001)- et al.
Introduction to Random Graphs
(2015) - et al.
On random graphs I
Publ. Math. (Debr.)
(1959) Hamiltonian circuits in random graphs
Discrete Math.
(1976)- et al.
Fast probabilistic algorithms for Hamiltonian circuits and matchings
J. Comput. Syst. Sci.
(1979) How many random edges make a graph Hamiltonian?
Combinatorica
(1983)- et al.
An algorithm for finding Hamilton paths and cycles in random graphs
Combinatorica
(1987)
A simple linear expected time algorithm for finding a Hamilton path
Discrete Math.
New distributed algorithms in almost mixing time via transformations from parallel algorithms
Virtual ring routing trends
Cited by (4)
Distributed CONGEST Algorithm for Finding Hamiltonian Paths in Dirac Graphs and Generalizations
2023, Leibniz International Proceedings in Informatics, LIPIcsHamiltonian Cycle Problem is in P
2021, arXiv