Download presentation
Presentation is loading. Please wait.
Published byConstance Chapman Modified over 9 years ago
1
Analysis of Algorithms Uri Zwick March 2014 Dynamic All-Pairs Shortest-Paths 1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA A A
2
Demetrescu-Italiano (2004) Locally Shortest Paths (LSPs) shortest path A LSP is not necessarily a SPs is a LSP iff l [ ] and r[ ] are SP
3
Shortest Path Extensions shortest path L[ ] - Left SP extensions R[ ] - Right SP extensions
4
Run Dijkstra “in parallel” from all vertices Consider only LSPs Keep left and right extensions of SPs found Keep candidate SPs in a priority queue (Static version) Demetrescu-Italiano (2004)
5
Combining two paths
6
(Static version) Demetrescu-Italiano (2004) New shortest path
7
Static APSP algorithm Demetrescu-Italiano (2004) Running time: Uniqueness assumption: All shortest paths are unique
8
SP(u,v) denotes the shortest path from u to v (Not explicitly maintained) p[u,v] – The second vertex on the shortest path from u to v found so far q[u,v] – The penultimate vertex on the shortest path from u to v found so far L[u,v] – A list of vertices w for which w SP(u,v) is known to be a shortest path R[u,v] – A list of vertices w for which SP(u,v) w is known to be a shortest path dist[u,v] – The length of the shortest path from u to v found so far
9
Static APSP algorithm
11
Dynamic algorithms An incremental algorithm only allows insertions An decremental algorithm only allows deletions A fully-dynamic algorithm allows both insertion and deletions
12
Example: Many LSPs Every path is an LSP – n 3 paths Two complete layers Can assign weights so that all SPs are unique n
13
Blue edges are significantly lighter than black edges Example: Many LSP changes When red edge inserted, all previous LSPs destroyed When red edge deleted, all previous LSPs recreated 0
14
A path is historic, if it was a shortest path at some point of time after the last update of one of its vertices Historical Paths (HPs) Let be a path at time t Let t’ be the time of the last update, before t, on A path is historic at time t if and only if there exists t’ t’’ t such that is a SP at time t’’ A path stops being historic only as a result of an update on it
15
Demetrescu-Italiano (2004) Locally Historical Paths (LHPs) historical path l[ ] and r[ ] are not necessarily shortest at the same time is a LHP iff l[ ] and r[ ] are HP
16
An empty vertex path
17
Converting an edge into a path
18
Combining two paths
19
Dynamic-APSP initialization
20
Insert and delete edges
21
Build-Paths
22
New-Shortest-Path
23
Examine a path
24
Removing a path
25
Update operations
26
A “full update” operation
27
Example: Many HPs and LSPs n Complete n n+1 2n2n 1 2 n
28
Phase 1: Decrease edge weights n Complete n n1n1 1 1 2 n
29
n n n1n1 1 n n1n1 1 Phase 2: Increase edge weights
30
n Complete n n1n1 1 n 2 1 n 3 new LHPs created at each step
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.