Skip to content

Commit 53cb581

Browse files
authored
Fix #143 (#229)
1 parent 3271ee6 commit 53cb581

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shortestpaths/astar.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ Compute a shortest path using the [A* search algorithm](http://en.wikipedia.org/
6666
- `s::Integer`: the source vertex
6767
- `t::Integer`: the target vertex
6868
- `distmx::AbstractMatrix`: an optional (possibly sparse) `n × n` matrix of edge weights. It is set to `weights(g)` by default (which itself falls back on [`Graphs.DefaultDistance`](@ref)).
69-
- `heuristic::Function`: an optional function mapping each vertex to a lower estimate of the remaining distance from `v` to `t`. It is set to `v -> 0` by default (which corresponds to Dijkstra's algorithm)
69+
- `heuristic`: an optional function mapping each vertex to a lower estimate of the remaining distance from `v` to `t`. It is set to `v -> 0` by default (which corresponds to Dijkstra's algorithm). Note that the heuristic values should have the same type as the edge weights!
7070
- `edgetype_to_return::Type{E}`: the eltype `E<:AbstractEdge` of the vector of edges returned. It is set to `edgetype(g)` by default. Note that the two-argument constructor `E(u, v)` must be defined, even for weighted edges: if it isn't, consider using `E = Graphs.SimpleEdge`.
7171
"""
7272
function a_star(
7373
g::AbstractGraph{U}, # the g
7474
s::Integer, # the start vertex
7575
t::Integer, # the end vertex
7676
distmx::AbstractMatrix{T}=weights(g),
77-
heuristic::Function=n -> zero(T),
77+
heuristic=n -> zero(T),
7878
edgetype_to_return::Type{E}=edgetype(g),
7979
) where {T,U,E<:AbstractEdge}
8080
# if we do checkbounds here, we can use @inbounds in a_star_impl!

0 commit comments

Comments
 (0)