Title: Spectral Analysis of Internet Topologies
1 Thu. Sept
18 03.
Single Source Shortest Paths
I . Dijkstras Algorithm
Algorithm Design
Paradigm Relaxation Reading CLRS
Paragraphs and these lecture
notes.
2Let G(V,E) be a directed graph with costs on its
edges C E?R. The cost of a path
is
A shortest path from u to v is a path of minimum
cost. The shortest path cost from u to v is
3Theorem A subpath of a shortest path is a
shortest path.
Proof Cut and paste.
4Single Source Shortest Path
The Problem From a single source vertex s, find
a shortest path to every other vertex. Assume
that all costs are positive.
s
5Single Source Shortest Path
Construct the tree of shortest paths
Idea
Fact There is a tree rooted at the source, such
that, for all nodes, the path from the root to
the node in the tree is a shortest path. Proof
Inductive on the number on nodes, and
cut and paste.
6Single Source Shortest Path
Construct the tree of shortest paths
Idea
- We will find the tree of shortest paths GREEDILY
- Maintain a set S of vertices within which the
- tree of shortest paths has been fully identified.
- 2. At each step add to S a vertex v in V-S
- whose distance estimate from S is minimal.
- 3. For all vertices adjacent to v,
- update the distance estimates and the candidate
- edges of the tree of shortest paths
Relaxation Step
7Relaxation Step
8estimate distances
Example
S
2
2
10
10
10
8
8
1
4
1
4
9
7
0
9
7
0
3
3
2
2
3
candidate tree edges
2
11
7
10
8
1
4
9
7
0
3
2
5
3
5
finalized tree edges
92
11
7
10
8
1
4
9
7
0
3
2
3
5
5
2
2
9
7
9
10
7
10
8
8
1
4
9
7
0
1
4
9
7
0
3
2
3
2
3
5
3
5
5
5
10Theorem. Dijkstras algorithm terminates with
for all
Proof. It suffices to show that
for every when v is added to S. Suppose
u is the first vertex added to S for which
. Let y be the first vertex in
along a shortest path from s to v, and
let x be its predecessor.
S
u
s
x
y
S, just before adding u
11Since u is the first vertex violating the claimed
invariant, we have .
Since subpaths of shortest paths are shortest
paths, it follows that was set to when
(x,y) was relaxed just after x was added to S.
Consequently we have But by
our choice of u, and hence
Contradiction.
S
u
s
x
y