analysis of algorithms

Post on 30-Dec-2015

23 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Analysis of Algorithms. Dynamic All-Pairs Shortest-Paths. Uri Zwick March 2014. TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A. Locally Shortest Paths (LSPs). Demetrescu-Italiano (2004). shortest path. shortest path. - PowerPoint PPT Presentation

TRANSCRIPT

Analysis of Algorithms

Uri ZwickMarch 2014

Dynamic All-Pairs Shortest-Paths

1

Demetrescu-Italiano (2004)Locally Shortest Paths (LSPs)

shortest path

shortest path

A LSP is not necessarily a SPs

is a LSP iff l[] and r[] are SP

Shortest Path Extensions

shortest path

L[] - Left SP extensions

R[] - Right SP extensions

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)

Combining two paths

(Static version)Demetrescu-Italiano (2004)

New shortest path

Static APSP algorithmDemetrescu-Italiano (2004)

Running time:

Uniqueness assumption:All shortest paths are unique

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 whichwSP(u,v) is known to be a shortest path

R[u,v] – A list of vertices w for whichSP(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

Static APSP algorithm

Dynamic algorithms

An incremental algorithm only allows insertions

An decremental algorithm only allows deletions

A fully-dynamic algorithm allows both insertion and deletions

Example: Many LSPs

Every path is an LSP – n3 paths

Two complete layers

Can assign weights so that all SPs are unique

n

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

A path is historic, if it was a shortest path at somepoint 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

Demetrescu-Italiano (2004)Locally Historical Paths (LHPs)

historical path

historical path

l[] and r[] are not necessarily shortest at the same time

is a LHP iff l[] and r[] are HP

An empty vertex path

Converting an edge into a path

Combining two paths

Dynamic-APSP initialization

Insert and delete edges

Build-Paths

New-Shortest-Path

Examine a path

Removing a path

Update operations

A “full update” operation

Example: Many HPs and LSPs

n

Complete Complete Complete

n

n+1

2n

1

2

n

Phase 1: Decrease edge weights

n

Complete Complete Complete

n

n1

1

1

2

n

n

Complete Complete Complete

n

n1

1

n

n1

1

Phase 2: Increase edge weights

n

Complete Complete Complete

n

n1

1

n

2

1

n3 new LHPs created at each step

top related