It is a NP problem to traverse the minimum number of stations in Beijing subway station, so there is no polynomial time algorithm to solve the problem.

Source: Internet
Author: User

Http://www.cnblogs.com/jiel/p/5852591.html

It is well known that the Hamiltonian circuit of a graph is an NPC question:
In the mathematical field of graph theory, a Hamiltonian path (or traceable path) are a path in an undirected or directed G Raph that visits each vertex exactly once. A Hamiltonian cycle (or Hamiltonian circuit) is a Hamiltonian path, which is a cycle. Determining whether such paths and cycles exist in graphs are the Hamiltonian path problem, which is np-complete.
(from Wiki:https://en.wikipedia.org/wiki/hamiltonian_path)

So for the problem of the-a option here, we're going to solve the problem, assuming we have a polynomial algorithm that solves the problem and gets the answer {len,{station1,station2,...}}, where Len is the least number of sites to repeat (counting multiple sites). followed by the name of the site passed. Then we only need to make an O (1) Judgment: If len==m print "Yes" Else print "no" to complete the existence of a non-graph Hamiltonian circuit of the judgment (M is the total number of sites). Therefore, it is concluded that there is a polynomial time complexity algorithm and a polynomial time complexity transfer, which makes it possible to determine the existence of the Hamiltonian loop problem can be solved. Obviously, the Hamiltonian circuit is an NPC problem. Therefore, there is no one polynomial algorithm to solve this problem.

Don't know if this deduction is correct? If it is correct, then I think this a-a problem is unresolved here (at least not to determine the exact solution).

Beijing Subway site traversal at least the number of stations is generally a NP problem, there is no polynomial time algorithm can solve the problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.