Skip to content

Commit

Permalink
Set dists[s] to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Aug 29, 2021
1 parent 1dee0a6 commit a198cd5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/a_star.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ function a_star_algorithm(g::LightGraphs.AbstractGraph{U}, # the g
nvg = nv(g)
checkbounds(distmx, Base.OneTo(nvg), Base.OneTo(nvg))
frontier = DataStructures.PriorityQueue{U,T}()
# The value should be `heuristic(s, t)` but it does not matter since it will
# be `dequeue!`d in the first iteration independently of the value.
frontier[U(s)] = zero(T)
visited = zeros(Bool, nvg)
dists = fill(typemax(T), nvg)
dists[s] = zero(T)
parents = zeros(U, nvg)
colormap = zeros(UInt8, nvg)
colormap[s] = 1
Expand Down

0 comments on commit a198cd5

Please sign in to comment.