StudySmarter AI is coming soon!

- :00Days
- :00Hours
- :00Mins
- 00Seconds

A new era for learning is coming soonSign up for free

Suggested languages for you:

Americas

Europe

Q15E

Expert-verifiedFound in: Page 716

Book edition
7th

Author(s)
Kenneth H. Rosen

Pages
808 pages

ISBN
9780073383095

**Extend Dijkstra’s algorithm for finding the length of a shortest path between two vertices in a weighted simple connected graph so that the length of a shortest path between the vertex a and every other vertex of the graph is found.**

In Dijkstra's algorithm to find the length of the shortest path from a to \(z\), allow the variable vertex to run over all the vertices of the given graph.

Dijkstra's algorithm to find the shortest path between two fixed vertices \(a\) and \(z\).

**Dijkstra's algorithm allows us to find the shortest path between any two vertices of a graph.**

Dijkstra's algorithm to find the shortest length between a given pair of vertices \(a\) and \(z\) proceeds as follows starting from the vertex \(a\), the algorithm finds new vertices iteratively in such a way that all the shortest paths are found from \(a\) to the vertices in the order in which they are found. The algorithm to find the shortest path between \(a\) and \(z\) terminates the moment \(z\) appears as a new vertex that has been just added.

In order to find the shortest path between \(a\) and all the vertices, we don't stop the algorithm at the vertex \(z\) (unless \(z\) is the last vertex to be introduced). Instead, we continue introducing new vertices till there are no more vertices to be added as new.

In other words, the extended Dijkstra algorithm terminates only when all the lengths of all the shortest paths from \(a\) to all the vertices have been found).

As an example, consider the weighted graph above. If we run the algorithm, we will find the shortest paths from \(a\) to \(u\), \(v\) and \(w\) as well ( the algorithm does not stop with \(z\)).

94% of StudySmarter users get better grades.

Sign up for free