Traveling Salesman - Exhaustive Algorithm

Asked

Viewed 146 times

1

I need to create an algorithm that: 1. Discover all possible paths that visit all vertices of a graph without going through the same vertices twice. 2. Store all results. 3. Return the path with the shortest distance.

In short, an exhaustive/crude solution to the Travelling Salesman Problem. I don’t even know how to make an algorithm that discovers all the possibilities, I thought of making one that tests everything randomly and stores only the different paths of the already stored ones, but then I would still not know when to stop(since I will never be able to guarantee that all possibilities have actually been tested).

  • Welcome to Stack Overflow! Your question seems to have some problems and your experience here in Stack Overflow may not be the best because of this. We want you to do well here and get what you want, but for that we need you to do your part. Here are some guidelines that will help you: Stack Overflow Survival Guide in Portuguese (short version). If the help is very simple it is still possible to do in the comments.

  • 2

    Could you give me more details? In this case, do you have the number of roads, their mileage? If you can edit the question and enter the information, it would help a lot.

  • I recommend checking this link https://towardsdatascience.com/solving-travelling-salesperson-problems-with-python-5de7e883d847

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.