Current location - Education and Training Encyclopedia - Graduation thesis - Dijkstra algorithm flow
Dijkstra algorithm flow
Define G=(V, e), define set S to store the vertices that have found the shortest path, and set T to store the vertices that have not found the shortest path, that is, there is t = v-s.

Dijkstra algorithm is described as follows:

(1) suppose that the edges of the weighted adjacency matrix represent the weighted directed graph, and the edges [i][j] represent the arc.

(2) Select Vj so that D[j]=Min{D[i]|Vi∈V-S}, and Vj is the end point of the shortest path from the currently found VS. Let S = S ∨{ Vj}

(3) Modify the shortest path length from Vs to any vertex Vk in the set V-S ... If d[j]+ edge [j] [k]

Repeat operation (2)(3)***n- 1 time. Thus, the shortest path from Vs to other vertices on the graph is obtained.