-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom priority queues for Dijkstra & Co #129
Comments
Here is an example of benchmark that shows the promise of this idea |
Is there really a good use case for letting the user choose their own priority queue? Maybe we should just pick the fasted one for them. Also, currently the priority queue used for Graphs.jl/src/shortestpaths/astar.jl Line 78 in 9039378
|
It doesn't cost much to define |
See https://discourse.julialang.org/t/fast-er-priority-queues/81269 for a discussion and some benchmarks |
Seems we can get about a 2x acceleration based on the HeapPriorityQueue. For unweighted graphs, it would also be nice to specialize the code. Because the priority queue at any given point will only hold two different values, I think we can avoid priority queue by storing vertices in two queues: one with the vertices at the currently evaluated distance, and one with vertices one unit further. |
For unweighted graphs, isn't Dijkstra just BFS? |
For which, by the way, an iterator would be nice (see #106) |
At the moment, shortest path algorithms such as Dijkstra and A* rely on the standard
PriorityQueue
from DataStructures.jl, partly because it supports updating the priority value of a stored element.However, there are alternative implementations that do not require this property, and those can be faster in many cases.
Would it make sense to add a method that lets the user choose the priority queue they want, along with the version of the algorithm (with or without priority updates)?
The text was updated successfully, but these errors were encountered: