I'm using the LEMON library in a project of mine and I have a doubt about how to best use it to evaluate a complete distance matrix between vertices in a given set.
So, consider we are given a large graph (represented as a ListDigraph
), a subset of vertices S
and we need to evaluate all shortest paths between any two vertices in S
.
The easiest way to do that would be running the Dijkstra
algorithm for each combination of two vertices in S
, but of course this not the best idea in terms of efficiency.
One thing that I thought was to evaluate one path from a vertex i to a vertex j, both in S
, and then search the ProcessedMap
for any other vertex in S. If I find one, say k, I already have the distance from i to k. This would most probably reduce the number of calls to the algorithm. However I still think there should be a better solution in lemon.
Is adding multiple sources of any help? I didn't quite understand yet the behaviour of the class Dijkstra
when using this feature.
Thank you =)