How can I find the number of Hamiltonian cycles in a complete undirected graph?

前端 未结 3 2014
再見小時候
再見小時候 2021-02-05 22:03

Can someone explain how to find the number of Hamiltonian cycles in a complete undirected graph?

Wikipedia says that the formula is (n-1)!/2, but when I cal

相关标签:
3条回答
  • 2021-02-05 22:44

    In answer to your Google Code Jam comment, see this SO question

    0 讨论(0)
  • 2021-02-05 22:52

    I think when we have a Hamiltonian cycle since each vertex lies in the Hamiltonian cycle if we consider one vertex as starting and ending cycle . we should use 2 edges of this vertex.So we have (n-1)(n-2)/2 Hamiltonian cycle because we should select 2 edges of n-1 edges which linked to this vertex.

    0 讨论(0)
  • 2021-02-05 23:03

    Since the graph is complete, any permutation starting with a fixed vertex gives an (almost) unique cycle (the last vertex in the permutation will have an edge back to the first, fixed vertex. Except for one thing: if you visit the vertices in the cycle in reverse order, then that's really the same cycle (because of this, the number is half of what permutations of (n-1) vertices would give you).

    e.g. for vertices 1,2,3, fix "1" and you have:

    123 132

    but 123 reversed (321) is a rotation of (132), because 32 is 23 reversed.

    There are (n-1)! permutations of the non-fixed vertices, and half of those are the reverse of another, so there are (n-1)!/2 distinct Hamiltonian cycles in the complete graph of n vertices.

    0 讨论(0)
提交回复
热议问题