Algorithm - 2023.1 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.1 English

The implemented Single Source Shortest Path is based on Bellman-Ford algorithm equiped with a First-In-First-Out queue. Below is the pseudo-code of the algorithm:

procedure SingleSourceShortestPath(graph, source)
for each vertex v in graph
    distance(v) := positive infinity

distance(source) := 0
push source into Q
while Q is not empty
    u := pop Q
    for each edge(u,v) in graph
        if distance(u) + weight(u,v) < d(v) then
            distance(v) := distance(u) + weight(u,v)
            push v into Q
        end if
    end for
end while

return distance

Here, graph is a graph with a list of vertices and a list of weighted edges. source is the start vertex of the algorithm. Q is a first-in-first-out queue. And the distance is iterated during the algorithms and returned as the result.