Dijkstra's K shortest path algorithm !!

Can anyone provide me code©/algorithm(loopless) for Dijkstra’s k shortest path algorithm using matrix convention ??

loopless???

1 Like

For all v ∈ V, d[v] = ∞, H.insert(v, d[v])

d[s] = 0, H.decreasepriority(s, 0)

while(!H.empty()) {
    v = H.deletemin()
    for all w adjacent to v {
        d[w] = min(d[w], d[v] + l(v, w))
        H.decreasepriority(w, d[w])
    }
}
1 Like

s is the source vertex
d[v] denotes the distance
other symbols have their usual meanings

Isn’t this an algorithm for “shortest path” problem and not “k shortest path” problem ?

oops, I just read the Dijkstra thing. And posted the single source shortest path algo from my notes that I was revising. :smiley:

Loopless algo, report nudity! :smiley:

I think this link is helpful for u.

//