We have some set of points (each point has its X and Y) and a multy map of roots [point, point]. We can move via roots from any point to any in any possible direction. We are given some path of 2d points we want to follow as close to as possible:
how to calculate a path like this:
that would look as alike as possible to given path? What are usefull algorithms that can do such thing (and are thay implemented in Boost Geometry or Graph or any other common opensource C++ library)?
This is a really cute little problem. If your graph is well connected a greedy approach might work quite well. As in: (1) set current position to be the node closest to the start of the path, (2) move to the adjacent node which is closest to the next point in the path until there is no closer point, (3) select next point in path and goto (2) if not finished.
If this algorithm gets stuck in cycles you will need A* search.
http://www.boost.org/doc/libs/1_47_0/libs/graph/doc/astar_search.html