Replies: 1 comment
-
I can see that Boost.Graph indeed allows the customization of the zero distance and the infinity distance per function invocation: https://www.boost.org/doc/libs/latest/libs/graph/doc/dijkstra_shortest_paths.html. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here is a use case for the Dijkstra's algorithm. In my graph, the edges represent some physical connections between locations, and weights of the edges represent the throughput of the corresponding connection. A throughput of a path in the graph is the throughput of the tightest edge in the path. Now I want to use
dijkstra_shortest_distances
to find a throughput of paths betweenseed
and all the other locations.So, I would have to use
std::greater
forcompare
, andstd::min
ascombine
. But I would also need the algorithm to be changed. Rather than using:zero
(for settingdistances[seed]
) andinfinity
(for setting initial distances),I would need these two values -- worst possible distance and best possible distance -- to be also parameters in this algorithm.
Another observation is that while there are valid alternative
compare
andcombine
, I cannot change them individually: {compare, combine, worst-distance, best-distance} is a quadruplet that need to travel together. "worst-sistance" is not a property of typDistance
, but is dependent oncompare
andcombine
.Maybe a helper structure would be needed:
This quadruplet would have to be passed to the algorithm.
There algorithm would also impose a semantic requirements on the elements of this quadruplet, which we can express as a test function:
Beta Was this translation helpful? Give feedback.
All reactions