• :00Days
• :00Hours
• :00Mins
• 00Seconds
A new era for learning is coming soon Suggested languages for you:

Europe

Answers without the blur. Sign up and see all textbooks for free! Q15E

Expert-verified Found in: Page 716 ### Discrete Mathematics and its Applications

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.

See the step by step solution

## Step 1: Given data

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

## Step 2: Concept used of Dijkstra’s algorithm

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

## Step 3: Find the path

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$$). ### Want to see more solutions like these? 