What algorithm can be used to bypass all vertices of the graph once to return to the starting vertex.

The graph is connected, undirected.

The graph is connected, undirected.

asked April 3rd 20 at 17:29

2 answers

answered on April 3rd 20 at 17:31

Is it possible to visit all the vertices of the graph and go back to start?

Can.

answered on April 3rd 20 at 17:33

Judging by the description, you need a Hamiltonian path.

This problem is NP-complete therefore, a simple and fast algorithm to humankind is not known. You can do a complete recovery again and heuristics. Some methods are simulated annealing or genetic algorithms can work faster, but it does not exactly have a long and painful poking around that would it work.

This problem is NP-complete therefore, a simple and fast algorithm to humankind is not known. You can do a complete recovery again and heuristics. Some methods are simulated annealing or genetic algorithms can work faster, but it does not exactly have a long and painful poking around that would it work.

Find more questions by tags PythonAlgorithms

Seriously, you don't know the count, so good luck. - Shanie_Armstrong98 commented on April 3rd 20 at 17:34