Checking if a Hamilton Cycle exists in a dense graph

孤人 提交于 2019-12-24 00:36:36

问题


A few definitions first:

Definition 1

A graph G = (V, E) is called ``dense'' if for each pair of non-adjacent vertices u and v, d(u) + d(v)>=n where n = |V| and d(*) denotes the degree of the vertex *

Definition 2

A ``Hamiltonian cycle'' on G is a sequence of vertices ( vi1, vi2,....vin, vi1 ) such that vil != vih for all l!=h and { vil, vil} is an edge of G.

The problem is: write a program that, given a dense undirected graph G = (V; E) as input, determines whether G admits a Hamiltonian cycle on G and outputs that cycle, if there is one, or outputs ``N'' if there is none.

my solution is to find all the possible paths starting from a source and to check if a path exists that gets back to this source. Unfortunately, this solution is not efficient.

any suggestions? Thank you.


回答1:


According to Ore's theorem, graphs satisfying Definition 1 always have a Hamiltonian cycle, and Palmer's algorithm will give you one in O(n2).




回答2:


The problem is NP-hard. So I would not expect any solution to be much faster than brute-force.



来源:https://stackoverflow.com/questions/11186097/checking-if-a-hamilton-cycle-exists-in-a-dense-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!