Code implicitly assumes that the heuristic output is of the same type as the graph weights.
When using A* I was attempting to use a heuristic function that return a float, but the default weights of the graph were ints.
Here is the example
using Graphs, LinearAlgebra, Random
Random.seed!(0)
xyz = rand(4000, 3)
g = random_regular_graph(4000, 4)
src = rand(1:4000)
dst = rand(1:4000)
h(v) = Int(round(norm(xyz[v, :] - xyz[dst, :])))
edges = a_star(g, src, dst, weights(g), h)
# The above works since I convert to int, below does not, I get InexactError: Int64(1.7553136893610342)
h(v) = norm(xyz[v, :] - xyz[dst, :])
edges = a_star(g, src, dst, weights(g), h)
Maybe we can gather an output of the heuristic, and use the output type to determine the type of the PriorityQueue (by assuming that the heuristic is type stable). Not the cleanest possible. I explored an other option in this discussion, but it seems hard to achieve...
I think it is the most reasonable option for now. The heuristic has to be computed on s first, so we might as well use that to choose the type of priority values
Going back to this, I just realized that basing the priority queue type on the output of a call to heuristic prevents static type inference. Better to add a recommendation to the docs I think.