# Dijkstra state?

**URL:** <https://discourse.julialang.org/t/dijkstra-state/20124>\
**Category:** General Usage\
**Created:** [January 26, 2019, 11:35am UTC](https://discourse.julialang.org/t/dijkstra-state/20124 "2019-01-26T11:35:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [January 26, 2019, 11:35am UTC](https://discourse.julialang.org/t/dijkstra-state/20124/1 "2019-01-26T11:35:30Z")

</div>

Hi, this is an easy task. I was wondering, what is the parameters of the dijkstra state in the following link:  
[https://github.com/JuliaGraphs/LightGraphs.jl/blob/master/src/shortestpaths/dijkstra.jl](https://github.com/JuliaGraphs/LightGraphs.jl/blob/master/src/shortestpaths/dijkstra.jl)

```julia
struct DijkstraState{T <: Real,U <: Integer} <: AbstractPathState
    parents::Vector{U}
    dists::Vector{T}
    predecessors::Vector{Vector{U}}
    pathcounts::Vector{UInt64}
    closest_vertices::Vector{U}
end

```

I need to finish a task very quickly, otherwise, I would figure it out by myself. Would rally appreciate if anyone can help me.

---

<div class="post-metadata">

**Author:** ![simonschoelly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonschoelly/32/21606_2.png) [@simonschoelly](https://discourse.julialang.org/u/simonschoelly)\
**Post date:** [January 26, 2019, 8:53pm UTC](https://discourse.julialang.org/t/dijkstra-state/20124/2 "2019-01-26T20:53:22Z")

</div>

If I read the code correctly the meanings are as follows:

- `parents[v]` : The vertex that comes right before `v` on a shortest path from the source to `v`.
- `dists[v]`: The length of the shortest path from the source vertices to `v`.
- `preds[v]`: The vertex that comes right before `v` on some shortest path from the source to `v`. The difference to `parents` is, that `parents` considers only one shortest path, but there could also be multiple. Is only created when `allpaths` is true.
- `pathcounts[v]`: The number of shortest paths from the sources to `v`.
- `closest_vertices`: A list of all the vertices of `g` in order of shortest distance to the sources. Is only created when `trackvertices` is `true`.
