M
M
Maxim2015-01-06 03:16:11
Programming
Maxim, 2015-01-06 03:16:11

What is the best algorithm for finding the optimal path through certain points?

There is a certain graph (cities), there is a certain number of key points on this graph (say 1000 pieces).
There are points A and B - the beginning and end of the route.
It is necessary to build a route from A to B through a certain number of key points.
Some number - i.e. draw only through those points that are more or less along the way.
In practice, tourist routes through the sights will be built.
I was able to google the traveling salesman problem, in the open version of the problem, almost what is needed is done. The problem remains one - the choice of optimal points through which the route will pass.
Perhaps someone knows a more suitable algorithm that can be taken as a basis?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
tsarevfs, 2015-01-06
@z17

Very similar to dynamics . You can try to build a graph (full?) of key points. Predict the distance between peaks on the map (A*).
Then you can either or just come up with tricky edge weights based on the length and rating of the attractions at the incident vertices. In this case, the path of maximum weight is needed.
Otherwise, you need to look for the path of maximum weight with a limit on the length. Surely people do not want to go around the whole city. It looks like the link says something similar.

S
Sergey Melnikov, 2015-01-06
@mlnkv

qiao.github.io/PathFinding.js/visual

M
maaGames, 2015-01-06
@maaGames

There are two algorithms: depth-first search and breadth-first search.
Depending on the straightness of the hands, depth-first search will require less memory and will work faster, but depth-first search will find the optimal (shortest in terms of the number of hops) path. Breadth-first search requires either modifying the data in the graph, or storing already visited nodes and nodes that are being processed at the current iteration separately.
Well, it would be nice not to fall into shock at the word "recursion".)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question