Finds the shortest path between a vertex and every other vertex in a graph.
The algorithm keeps track of the visited and unvisited vertices, and analyzes the edges of all unvisited vertex one by one. The shortest distance is saved, and if a smaller distance is found along the process it is updated.
All the edges of the graph are visited, and the shortest path from a given vertex to any other vertex is the minimal sum of the edges that connect them.