2

Given a dense graph (according to ore's theorem, dense means the sum of degrees of any 2 non-adjacent nodes is at least N, where N is the total number of nodes), we can find a Hamiltonian cycle in such a graph using Palmer's algorithm with a time complexity of O(n^2). My question is: Can we do better than this? (in terms of time complexity).

Traveling Salesman
  • 2,209
  • 11
  • 46
  • 83
  • Note that a dense graph has Θ(n²) edges, so examining all of its edges would necessarily require at least O(n²) time. That doesn't *automatically* prove that any algorithm to find a Hamiltonian cycle would require at least O(n²) time — not every such algorithm necessarily examines *all* edges — but I rather doubt that anyone seeing this question will manage to find one that's guaranteed to examine fewer than quadratically many edges. – ruakh Nov 19 '21 at 01:14
  • To check if two nodes are connected while running the algorithm, you can use an adjacency matrix with O(1) time for each check so there should be no problem in that. But populating your adjacency matrix at the beginning of your program would indeed require O(n^2) iterations but I am not sure if we can consider that as part of the algorithm. – Traveling Salesman Nov 19 '21 at 09:22
  • As you say, *each* adjacency check requires O(1) time. What I'm saying is that I think you'll need to do O(n²) checks in the worst case, because we know that a graph with fewer than O(n²) edges need not be Hamiltonian, which implies that any one of these edges can turn out to "matter". (But, that's not a proof. Perhaps you'll find a way to reliably identify a subset of edges that form a Hamiltonian cycle without needing to check O(n²) extras.) – ruakh Nov 19 '21 at 12:38
  • 1
    Ore's theorem only requires that nonadjacent nodes have degree sum at least N; your statement is much stronger and almost equivalent to the conditions from Dirac's theorem. In any case, a graph satisfying Ore's theorem has at least `(n^2) / 4` edges. The algorithm you're asking for would need to be faster than standard depth first search as well. Randomized algorithms may help; it appears that the O(n^2) version of Palmer's algorithm relies on randomization. – kcsquared Nov 19 '21 at 15:56
  • I edited the question. Sorry I missed the non-adjacent part in the previous version. Again, I am not considering the population of edges to be part of the algorithm. I can receive the adjacency matrix and Palmer's algorithm does not really iterate through all edges, but rather attempts to rearrange the nodes order to form a cycle. I am not saying it is possible or not to do better than Palmer's, but I do not see the edges necessarily an issue in the way to improving this. – Traveling Salesman Nov 19 '21 at 21:14
  • This looks like a research level theoretical computer science question rather than a programming question. https://cstheory.stackexchange.com/ – n. m. could be an AI Nov 19 '21 at 21:29

0 Answers0