Persistent Data Structures (Version Control) Partial Partial Full - - PowerPoint PPT Presentation

persistent data structures version control
SMART_READER_LITE
LIVE PREVIEW

Persistent Data Structures (Version Control) Partial Partial Full - - PowerPoint PPT Presentation

Persistent Data Structures (Version Control) Partial Partial Full Full Confluently Confluently Purely Purely Ephemeral persistence persistence persistence functional version version version v 0 v 0 v 0 v 0 list tree DAG car cdr


slide-1
SLIDE 1

Persistent Data Structures (Version Control)

Partial Full Confluently Purely

update

v0

Ephemeral

v0

Partial persistence

v0

Full persistence

v0

Confluently persistence Purely functional

car cdr version DAG version tree version list

update

v1 v1 v1 v2 v1 v2

never modify

  • nly create new pairs
  • nly DAGs

v2 v v2 v

query only

v3 v v6 v

2

v3 v v3 v4 v3 v4

y

v4

updates at leaves any version can be copied query all versions

v5

update/merge/query all versions

v5 v5 v5

query all versions

Retroactive

v v v v v

1

v6

query

v6

update & query

v0 v1 v2 v3 v4

update & query all versions updates in the past propragate

slide-2
SLIDE 2

Planar Point Location

T1 T2 T3 T4 T5 T6 T7

update

Partial persistent search trees

2

search trees

O(n∙log n) preprocessing, O(log n) query

slide-3
SLIDE 3

Path copying (trees)

root pointer

c c a f f d e d g e

3

slide-4
SLIDE 4

Partial persistence

Version ID time 0 1 2 Version ID = time = 0,1,2,... Fast node (any data structure) ( y )

– record all updates in node (version,value) pairs – field updates O(1) fi ld i d i id ( h / )

field1: (0,x) (3,y) (7,z) field2: (0,a) (14,c) (16,b)

– field queries ≡ predecessor wrt version id (search tree/vEB)

Node copying (O(1) degree data structures)

P i t t d ll ti f d h lid f – Persistent node = collection of nodes, each valid for an interval of versions, with Δ extra updates, Δ = max indegree – pointers must have subinterval of the node pointing to;

  • therwise copy and insert pointers (cacading copying)
  • therwise copy and insert pointers (cacading copying)

NB: Needs to keep track of back‐pointers

[0,8[ [8,13[ [13,∞[

4

field1: (0,x) (3,y) field2: (0,a) (7,c) field1: (8,z) (10,w) field2: (8,c) (9,d) field1: (13,w) (q5,y) field2: (13,e) (14,c)

slide-5
SLIDE 5

Full persistence

1 1 4 3 2 6 5 7 1 4 3 2 i li d l increasing version 6 5 7 Version tree (numbers = version ids) Version list (order maintenance data structure) preorder traversal

Fat node

– Updates (1,x) (6,y) (7,z) to a field

(numbers version ids) field: (1,x) (7,z) (5,x) (6,y) (2,x)

p ( , ) ( ,y) ( , ) – Queries = binary search among versions – Update (7,z): Insert 7 as leftmost child of 4; insert pairs for 7 and 5=succ(7)

( , ) ( , ) ( , ) ( ,y) ( , )

Node splitting (≥2Δ ekstra fields)

[0,∞[ [4,3[ [0,5[ [5,∞[ [4,5[ [5,3[

5

field1: (1,a) (4,b) (3,a) (2,c) field2: (1,f) (7,g) (5,f) [ , [ field1: (1,a) (4,b) field2: (1,f) (7,g) field1: (5,b) (3,a) (2,c) field2: (5,f) split version 5 [ [ [ [

slide-6
SLIDE 6

Persistence techniques

[N. Sarnak, R.E. Tarjan, Planar point location using persistent search trees, Communications of the ACM, 29(7), 669‐679, 1986]

  • Partial persistence, trees, O(1) access, amortized O(1) update

p , , ( ) , ( ) p

[J.R. Driscoll, N. Sarnak, D.D. Sleator, R.E. Tarjan, Making Data Structures Persistent, Journal of Computer and System Sciences, 38(1), 86‐124, 1989]

P i l & f ll i O(1) d d O(1)

  • Partial & full persistence, O(1) degree data structures, O(1) access,

amortized O(1) update

[P.F. Dietz, R. Raman, Persistence, Amortization and Randomization. Proceedings 2nd Annual ACM SIAM Symposium on Discrete Algorithms 78 88 1991] Annual ACM‐SIAM Symposium on Discrete Algorithms, 78‐88, 1991] [G.S. Brodal, Partially Persistent Data Structures of Bounded Degree with Constant Update Time, Nordic Journal of Computing, volume 3(3), pages 238‐255, 1996]

  • Partial persistence, O(1) degree data structures, O(1) access & updates

Partial persistence, O(1) degree data structures, O(1) access & updates update

[P.F. Dietz, Fully Persistent Arrays. Proceedings 1st Workshop on Algorithms and Data Structures, LNCS 382, 67‐74, 1989]

  • Full persistence, RAM structures, O(loglog n) access, O(loglog n) amortized

expected updates

6

slide-7
SLIDE 7

Comparison of persistence techniques

Copy data structure for each version

– no query overhead, slow updates & wastes a lot of space

Record updates & keep current version

– fast updates & queries to current version, space efficient, slow queries in the past

Path copying

– applies to trees, no query overhead, space overhead = depth of update

Fat node Fat node

– partial persistence: O(1) updates and space optimal, loglog n query overhead – full persistence: O(loglog n) expected amortized updates and space optimal, loglog n query overhead

Node copying/splitting

– fast updates & queries (amortized updates for full persistence) – only works for pointer‐based structures with O(1) degree y p ( ) g

7