Hi all,
I am reading the blog post which explains the algorithm used for map-matching, and I find the following paragraph in the “The enhancements” section a bit unclear:
A more complex solution could be to maintain a list of e.g. 3 alternative end-results. As you already get 3 edge candidates for every GPX point you can then try to find all routes between them. You could think that this will slow down the search a lot but with GraphHopper you can tweak e.g. the Dijkstra or DijkstraOneToMany algorithm to do this in an efficient manner. E.g. if you want to get the best result but you want to search from multiple destinations you can do: DijkstraBidirectionRef dijkstra = new DijkstraBidirectionRef(hopper.getGraph(), flagEncoder, weighting); dijkstra.initFrom(nodeFrom, distanceToPossibility1); dijkstra.initFrom(node, distanceToPossibility2); … dijkstra.initTo(nodeTo, distanceToEndPossibility1); dijkstra.initTo(nodeTo, distanceToEndPossibility2); …
Does it mean that 1) between each two consecutive GPX points, I find 3*3 = 9 paths; 2) for the complete GPX points list (assuming N points), I will have 3^N paths; and 3) somehow I maintain a list of 3 alternative paths for the complete GPX points list as end results? I think I must have misunderstood something as this seems quite inefficient.
I am also not clear about the example at the end of the paragraph. After I have done .initFrom() and .initTo() for all 3 edge candidates for both GPX points, how do I get the 9 paths connecting each pair of them? Do I still need to run .calcPath() for 9 times?
Could you please help clarify? Thank you very much.
Best regards,
He