[go: up one dir, main page]

0% found this document useful (0 votes)
20 views19 pages

Shortest Path

This document discusses algorithms for finding shortest paths in graphs. It describes Dijkstra's algorithm for finding single-source shortest paths and the Floyd-Warshall algorithm for solving the all-pairs shortest path problem on a directed graph in O(V3) time. It also discusses the structure of shortest paths and how intermediate vertices are considered in the Floyd-Warshall algorithm.

Uploaded by

Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views19 pages

Shortest Path

This document discusses algorithms for finding shortest paths in graphs. It describes Dijkstra's algorithm for finding single-source shortest paths and the Floyd-Warshall algorithm for solving the all-pairs shortest path problem on a directed graph in O(V3) time. It also discusses the structure of shortest paths and how intermediate vertices are considered in the Floyd-Warshall algorithm.

Uploaded by

Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Shortest Path

Unit -5
Single-Source Shortest Paths
Single-Source Shortest Paths
Single-Source Shortest Paths
Dijkstra’s algorithm
Dijkstra’s algorithm
Dijkstra’s algorithm
All-Pairs Shortest Paths
The Floyd-Warshall algorithm
• We will use a different dynamic-programming
formulation to solve the all-pairs shortest-
paths problem on a directed graph G =(V, E).
The resulting algorithm, known as the Floyd-
Warshall algorithm, runs in theta (V3)time. As
before, negative-weight edges may be
present, but we assume that there are no
negative-weight cycles.
The structure of a shortest path
• The Floyd-Warshall algorithm considers the
intermediate vertices of a shortest path,
where an intermediate vertex of a simple path
p =<v1, v2,….vl> is any vertex of p other than
v1 or vl, that is, any vertex in the set <v2, v3,
…….vl>.
The structure of a shortest path
The structure of a shortest path
The structure of a shortest path
The structure of a shortest path
The structure of a shortest path
shortest path
The structure of a shortest path
The structure of a shortest path
The structure of a shortest path

You might also like