design and analysis of data structures for dynamic treesloukas/courses/grad/data_structures... ·...
TRANSCRIPT
![Page 1: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/1.jpg)
Design and Analysis ofData Structures for Dynamic Trees
Renato Werneck
Advisor: Robert Tarjan
![Page 2: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/2.jpg)
Outline
⇒ The Dynamic Trees problem
• Existing data structures
• A new worst-case data structure
• A new amortized data structure
• Experimental results
• Final remarks
![Page 3: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/3.jpg)
The Dynamic Trees Problem
• Dynamic trees:
– Goal: maintain an n-vertex forest that changes over time.
∗ link(v, w): adds edge between v and w.
∗ cut(v, w): deletes edge (v, w).
– Application-specific data associated with vertices/edges:
∗ updates/queries can happen in bulk (entire paths or trees at once).
• Concrete examples:
– Find minimum-weight edge on the path between v and w.
– Add a value to every edge on the path between v and w.
– Find total weight of all vertices in a tree.
• Goal: O(log n) time per operation.
![Page 4: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/4.jpg)
Applications
• Subroutine of network flow algorithms
– maximum flow
– minimum cost flow
• Subroutine of dynamic graph algorithms
– dynamic biconnected components
– dynamic minimum spanning trees
– dynamic minimum cut
• Subroutine of standard graph algorithms
– multiple-source shortest paths in planar graphs
– online minimum spanning trees
• · · ·
![Page 5: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/5.jpg)
Application: Online Minimum Spanning Trees
• Problem:
– Graph on n vertices, with new edges “arriving” one at a time.
– Goal: maintain the minimum spanning forest (MSF) of G.
• Algorithm:
– Edge e = (v, w) with length `(e) arrives:
1. If v and w in different components: insert e;
2. Otherwise, find longest edge f on the path v · · ·w:
∗ `(e) < `(f): remove f and insert e.
∗ `(e) ≥ `(f): discard e.
![Page 6: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/6.jpg)
Example: Online Minimum Spanning Trees
• Current minimum spanning forest.
![Page 7: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/7.jpg)
Example: Online Minimum Spanning Trees
• Edge between different components arrives.
![Page 8: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/8.jpg)
Example: Online Minimum Spanning Trees
• Edge between different components arrives:
– add it to the forest.
![Page 9: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/9.jpg)
Example: Online Minimum Spanning Trees
• Edge within single component arrives.
![Page 10: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/10.jpg)
Example: Online Minimum Spanning Trees
• Edge within single component arrives:
– determine path between its endpoints.
![Page 11: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/11.jpg)
Example: Online Minimum Spanning Trees
• Edge within single component arrives:
– find longest edge on the path between its endpoints.
![Page 12: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/12.jpg)
Example: Online Minimum Spanning Trees
• Edge within single component arrives:
– if longest edge on the path longer than new edge, swap them.
![Page 13: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/13.jpg)
Online Minimum Spanning Trees
• Data structure must support the following operations:
– add an edge;
– remove an edge;
– decide whether two vertices belong to the same component;
– find the longest edge on a specific path.
• Each in O(log n) time:
– basic strategy: map arbitrary tree onto balanced tree.
![Page 14: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/14.jpg)
Data Structures for Dynamic Trees
• Different applications require different operations.
• Desirable features of a data structure for Dynamic Trees:
– low overhead (fast);
– simple to implement;
– intuitive interface (easy to adapt, specialize, modify);
– general:
∗ path and tree queries;
∗ no degree constraints;
∗ rooted and unrooted trees.
![Page 15: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/15.jpg)
Outline
• The Dynamic Trees problem
⇒ Existing data structures
• A new worst-case data structure
• A new amortized data structure
• Experimental results
• Final remarks
![Page 16: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/16.jpg)
Main Strategies
• Path decomposition:
– ST-trees [Sleator and Tarjan 83, 85];
∗ also known as link-cut trees or dynamic trees.
• Tree contraction:
– Topology trees [Frederickson 85];
– Top trees [Alstrup, Holm, de Lichtenberg, and Thorup 97];
– RC-trees [Acar, Blelloch, Harper, Vittes, and Woo 04].
• Linearization:
– ET-trees [Henzinger and King 95, Tarjan 97];
– Less general: cannot handle path queries.
![Page 17: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/17.jpg)
Path Decomposition
• ST-trees [Sleator and Tarjan 83, 85]:
– partition the tree into vertex-disjoint paths;
– represent each path as a binary tree;
– “glue” the binary trees appropriately.
![Page 18: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/18.jpg)
Path Decomposition
• ST-trees [Sleator and Tarjan 83, 85]:
– partition the tree into vertex-disjoint paths;
– represent each path as a binary tree;
– “glue” the binary trees appropriately.
• Complexity:
– with ordinary balanced trees: O(log2 n) worst-case;
– with globally biased trees: O(log n) worst-case;
– with splay trees: O(log n) amortized, but much simpler.
• Main features:
– relatively low overhead (one node per vertex/edge);
– adapting to different applications requires knowledge of inner workings;
– tree-related queries require bounded degrees (or ternarization).
![Page 19: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/19.jpg)
Contractions: Rake and Compress
•
vu
w
vu
vuvwu
Proposed by Miller and Reif [1985] (parallel setting).
• Rake:
– eliminates a degree-one vertex;
– edge combined with successor:
∗ assumes circular order.
• Compress:
– eliminates a degree-two vertex;
– combines two edges into one.
• Original and resulting edges are clusters:
– cluster represents both a path and a subtree;
– user defines what to store in the new cluster.
![Page 20: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/20.jpg)
Contractions
• Contraction:
– series of rakes and compresses;
– reduces tree to a single cluster (edge).
• Any order of rakes and compresses is “right”:
– final cluster will have the correct information;
– data structure decides which moves to make:
∗ just “asks” the user how to update values after each move.
• Example:
– work in rounds;
– perform a maximal set of independent moves in each round.
![Page 21: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/21.jpg)
Contractions: Example
i
o
f
g
b
h
k
c
l
j
dm
a
ne
![Page 22: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/22.jpg)
Contractions: Example
i
o
f
g
b
h
k
c
l
j
dm
a
ne
![Page 23: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/23.jpg)
Contractions: Example
i
o
f
g
b
h
c
m
ne
![Page 24: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/24.jpg)
Contractions: Example
i
o
f
g
b
h
c
m
ne
![Page 25: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/25.jpg)
Contractions: Example
ig
b
h
m
ne
![Page 26: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/26.jpg)
Contractions: Example
ig
b
h
m
ne
![Page 27: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/27.jpg)
Contractions: Example
ig
h ne
![Page 28: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/28.jpg)
Contractions: Example
ig
h ne
![Page 29: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/29.jpg)
Contractions: Example
i
ne
![Page 30: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/30.jpg)
Contractions: Example
i
ne
![Page 31: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/31.jpg)
Contractions: Example
ne
![Page 32: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/32.jpg)
Top Trees: Example
ennei
neig
h ne
ig
b
hm
ne
io
f
g
b
h
c
m
ne
io
f
g
b
h
kc
l
jd m
a
ne
![Page 33: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/33.jpg)
Top Trees: Example
en
inei
nei
neig
h ne
ig
b
hm
ne
io
f
g
b
h
c
m
ne
io
f
g
b
h
kc
l
jd m
a
ne
![Page 34: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/34.jpg)
Top Trees: Example
en
in
inhi
ei
gieg
nei
neig
h ne
ig
b
hm
ne
io
f
g
b
h
c
m
ne
io
f
g
b
h
kc
l
jd m
a
ne
![Page 35: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/35.jpg)
Top Trees: Example
en
in
in
mnim
hi
hi
ei
gi
gi
eg
egbg
nei
neig
h ne
ig
b
hm
ne
io
f
g
b
h
c
m
ne
io
f
g
b
h
kc
l
jd m
a
ne
![Page 36: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/36.jpg)
Top Trees: Example
en
in
in
mn
mn
im
immo
hi
hi
hi
ei
gi
gi
gifg
eg
eg
eg
bg
bccg
nei
neig
h ne
ig
b
hm
ne
io
f
g
b
h
c
m
ne
io
f
g
b
h
kc
l
jd m
a
ne
![Page 37: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/37.jpg)
Top Trees: Example
en
in
in
mn
mn
mnlm
im
im
kmik
mo
mo
hi
hi
hi
hi
ei
gi
gi
gi
giij
fg
fg
eg
eg
eg
egdg
bg
bc
bc
cg
cgac
nei
neig
h ne
ig
b
hm
ne
io
f
g
b
h
c
m
ne
io
f
g
b
h
kc
l
jd m
a
ne
![Page 38: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/38.jpg)
Contractions: Updating Values
•
CA
B
CBA
To find the minimum-cost edge on the tree:
– rake: C ← minA, B– compress: C ← minA, B
• To find the maximum edge on a path:
– rake: C ← B.
– compress: C ← maxA, B
• To find the length of a path:
– rake: C ← B
– compress: C ← A + B
![Page 39: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/39.jpg)
Contractions: Example with Values
93 9
16
7
8
141
7
49
1
i
o
f
g
b
h
k
c
l
j
dm
a
ne
![Page 40: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/40.jpg)
Top Trees: Path Lengths
21
147
14743
957438
956749371
91416741939718
en
in
in
mn
mn
mnlm
im
im
kmik
mo
mo
hi
hi
hi
hi
ei
gi
gi
gi
giij
fg
fg
eg
eg
eg
egdg
bg
bc
bc
cg
cgac
nei
neig
h ne
ig
b
hm
ne
io
f
g
b
h
c
m
ne
io
f
g
b
h
kc
l
jd m
a
ne
![Page 41: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/41.jpg)
Top Trees
• Top tree embodies a contraction:
– top tree root represents the entire original tree;
– expose(v, w) ensures that path v · · ·w is represented at the root;
– interface only allows direct access to the root.
• Other operations:
– link: joins two top trees;
– cut: splits a top tree in two;
– Goal: make link, cut, and expose run in O(log n) time.
• Known implementation [Alstrup et al. 97]:
– interface to topology trees:
∗ variant where clusters are vertices;
∗ degree must be bounded.
![Page 42: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/42.jpg)
Outline
• The Dynamic Trees problem
• Existing data structures
⇒ A new worst-case data structure
• A new amortized data structure
• Experimental results
• Final remarks
![Page 43: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/43.jpg)
Tree Contraction
• Contraction scheme:
– Work in rounds, each with a maximal set of independent moves.
• Lemma: there will be at most O(log n) levels.
– At least half the vertices have degree 1 or 2.
– At least one third of those will disappear:
∗ a move blocks at most 2 others.
– No more than 5/6 of the original vertices will remain.
![Page 44: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/44.jpg)
Online MSF on Augmented Stars
•
en
in
in
mn
mn
mnlm
im
im
kmik
mo
mo
hi
hi
hi
hi
ei
gi
gi
gi
giij
fg
fg
eg
eg
eg
egdg
bg
bc
bc
cg
cgac
Corollary: expose(v, w) can be implemented in O(log n) time.
– Temporarily eliminate all clusters with v or w as internal vertices:
∗ at most two per level: O(log n).
![Page 45: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/45.jpg)
Online MSF on Augmented Stars
•
mn
mn
mnlmkmik
mo
mo
hi
hi
hi
hi
gi
gi
gi
giij
fg
fg
eg
eg
egdg
bc
bc
cg
cgac
Corollary: expose(v, w) can be implemented in O(log n) time.
– Temporarily eliminate all clusters with v or w as internal vertices:
∗ at most two per level: O(log n).
– Build a temporary top tree on the remaining root clusters.
– Restore original tree.
![Page 46: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/46.jpg)
Tree Contraction
• Update scheme:
– Goal: minimize “damage” to original contraction after link or cut.
– For each level (bottom-up), execute two steps:
1. replicate as many original moves as possible;
2. perform new moves until maximality is achieved.
– Step 1 is implicit.
![Page 47: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/47.jpg)
Updates: Example
![Page 48: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/48.jpg)
Updates: Example
![Page 49: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/49.jpg)
Updates: Example
new move
6
these moves cannot be replicated
![Page 50: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/50.jpg)
Updates: Example
![Page 51: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/51.jpg)
Updates: Example
![Page 52: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/52.jpg)
Updates: Example
![Page 53: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/53.jpg)
Updates: Example
![Page 54: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/54.jpg)
Updates: Example
![Page 55: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/55.jpg)
Updates: Example
![Page 56: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/56.jpg)
Updates: Example
![Page 57: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/57.jpg)
Updates: Example
![Page 58: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/58.jpg)
Updates: Example
![Page 59: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/59.jpg)
Updates: Example
![Page 60: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/60.jpg)
Updates: Example
![Page 61: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/61.jpg)
Updates: Example
![Page 62: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/62.jpg)
Updates: Example
![Page 63: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/63.jpg)
Updates: Example
![Page 64: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/64.jpg)
Updates: Example
![Page 65: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/65.jpg)
Updates: Example
![Page 66: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/66.jpg)
Updates: Example
![Page 67: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/67.jpg)
Running Time
• Theorem: each level can be updated in O(1) time.
• Only need to worry about the core:
– connected subgraph induced by the new (active) clusters;
– remaining clusters: inactive subgraph.
![Page 68: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/68.jpg)
Running Time
• Theorem: each level can be updated in O(1) time.
• Only need to worry about the core:
– connected subgraph induced by the new (active) clusters;
– remaining clusters: inactive subgraph.
![Page 69: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/69.jpg)
Running Time
• Theorem: each level can be updated in O(1) time.
• Only need to worry about the core:
– connected subgraph induced by the new (active) clusters;
– remaining clusters: inactive subgraph.
• Suffices to prove that core size s is bounded by a constant.
– If core were a free tree, would shrink by 1/6 between rounds.
– Each point of contact will add O(1) clusters to the core.
– Claim: there are at most four points of contact.
– Constant initial size + multiplicative decrease + additive increase:
⇒ constant size.
![Page 70: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/70.jpg)
Contraction-based Data Structure
• Positive aspects:
– general (top tree interface);
– conceptually simple algorithm;
– direct implementation (does not use topology trees);
– O(log n) worst case.
• Potential overheads:
– pointers within and among levels:
∗ need Euler tour of each level;
– unmatched clusters are repeated (dummy nodes).
• Joint work with J. Holm, R. Tarjan, and M. Thorup.
![Page 71: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/71.jpg)
Outline
• The Dynamic Trees problem
• Existing data structures
• A new worst-case data structure
⇒ A new amortized data structure
• Experimental results
• Final remarks
![Page 72: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/72.jpg)
Representation
• Consider some unrooted tree:
![Page 73: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/73.jpg)
Representation
•
z
Make it a unit tree:
– directed tree with degree-one root.
![Page 74: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/74.jpg)
Representation
•
w zyx
vu
Pick a root path:
– starts at a leaf;
– ends at the root.
abc
abc
![Page 75: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/75.jpg)
Representation
•
w zyx
vu
yz
xywx
Nx
Ny
vwuv
Nv
Nw
Represent the root path as a binary tree:
– leaves: base clusters (original edges);
– internal nodes: compress clusters.
![Page 76: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/76.jpg)
Representation
•
w zyx
vu
yz
xywx
Nx
Ny
vwuv
Nv
Nw
What if a vertex has degree greater than two?
– Recursively represent each subtree rooted at the vertex
(at most two, because of circular order).
abc
abc
![Page 77: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/77.jpg)
Representation
•
EC
DBA
w zyx
vu
yz
xywx
Nx
Ny
vwuv
Nv
Nw
What if a vertex has degree greater than two?
– Recursively represent each subtree rooted at the vertex.
– Before vertex is compressed, rake subtrees onto adjacent cluster.
abc
abc
![Page 78: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/78.jpg)
Representation
•
EC
DBA
w zyx
vu
yzE
xywx
NxD
NyC
vwuvA
NvB
Nw
Representation:
– Up to four children per node (two proper ones, two foster ones)
– Meaning: up to two rakes followed by a compress.
– Example: Ny = compress(rake(D,Nx ), rake(E, yz )) = wz .
abc
![Page 79: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/79.jpg)
Representation
•
w zyx
vu
How does the recursive representation work?
– Must represent subtrees rooted at the root path.
![Page 80: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/80.jpg)
Representation
•
w
How does the recursive representation work?
– Must represent subtrees rooted at the root path.
![Page 81: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/81.jpg)
Representation
•
w
How does the recursive representation work?
– Must represent subtrees rooted at the root path.
– Each subtree is a sequence of unit trees with a common root.
![Page 82: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/82.jpg)
Representation
•
RQ
P
w
How does the recursive representation work?
– Must represent subtrees rooted at the root path.
– Each subtree is a sequence of unit trees with a common root.
– Represent each recursively.
![Page 83: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/83.jpg)
Representation
•
RQ
P
w
RQ
P
How does the recursive representation work?
– Must represent subtrees rooted at the root path.
– Each subtree is a sequence of unit trees with a common root.
– Represent each recursively.
– Build a binary tree of rakes.
![Page 84: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/84.jpg)
Representation
• Two different views:
– User interface: tree contraction.
∗ sequence of rakes and compresses;
∗ a single tree (a top tree).
– Implementation: path decomposition.
∗ maximal edge-disjoint paths;
∗ hierarchy of binary trees (rake trees/compress trees);
∗ similar to ST-trees.
![Page 85: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/85.jpg)
Representation
•
o
nm
lk
j
ih
gf
e
d
cb
a
w zyx
vu
yz
fy
dyde
Nd
fy
xywx
Nxcy
Ny
ow
jwjljk
Njknkm
Nk
ow
gwgihg
Ng
ow
vwuvav
Nvbw
Nw
Full example:
![Page 86: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/86.jpg)
Self-Adjusting Top Trees
• Topmost compress tree represents the root path:
– determined by expose(v, w);
– implementation similar to ST-trees;
– basic operations:
∗ splay: rebalances each binary tree;
∗ splice: changes the partition into paths.
• Main result: expose takes O(log n) amortized time.
• Operations link and cut use expose as the main subroutine.
• Joint work with R. Tarjan [SODA’05].
![Page 87: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/87.jpg)
Outline
• The Dynamic Trees problem
• Existing data structures
• A new worst-case data structure
• A new amortized data structure
⇒ Experimental results
• Final remarks
![Page 88: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/88.jpg)
Experimental Results
• Data structures implemented (in C++):
– TOP-W: worst-case top trees;
– TOP-S: self-adjusting top trees;
– ET-S: self-adjusting ET-trees;
– ST-V/ST-E: self-adjusting ST-trees;
– LIN-V/LIN-E: “obvious” linear-time data structure.
• Machine: 2.0 GHz Pentium IV with 1 GB of RAM.
• Applications:
– random operations;
– maximum flows;
– online minimum spanning trees;
– shortest paths.
![Page 89: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/89.jpg)
Experimental Results: Executive Summary
• ST-V: fastest O(log n) algorithm;
– ST-E and ET-S: up to twice as slow.
• TOP-S is 2–4 times as slow as ST-V.
• TOP-W vs. TOP-S:
– TOP-S faster for links and cuts;
– TOP-W faster for expose;
– TOP-S benefits from correlated operations (splaying).
• LIN-V/LIN-E: fastest for paths with up to ∼1000 vertices.
![Page 90: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/90.jpg)
Experiment: Random Operations
•
64
32
16
8
4
2
1
1/2
1/4
1/8 65536 16384 4096 1024 256 64
micr
osec
onds
per
ope
ratio
n
vertices
TOP-WTOP-S
ET-SST-V
LIN-V
Setup:
– Start with empty graph on n vertices;
– use n− 1 links to create a random spanning tree;
– alternate cuts and links until #ops = 10n.
![Page 91: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/91.jpg)
Experiment: Maximum Flow
• Maximum flow:
– Given: directed graph with n vertices and m edges, source s, sink t;
– Goal: find maximum flow from s to t.
• Algorithm:
– Find shortest path from s to t with positive residual capacity;
– send as much flow as possible, update residual capacities, repeat;
– running time: O(mn2).
• With dynamic trees:
– Keep “partial paths” between iterations as a forest;
– allows augmentations in O(log n) time;
– running time: O(mn log n).
![Page 92: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/92.jpg)
Maximum Flow on Layered Networks
•
32
16
8
4
2
1
1/2
1/4
1/8 65536 32768 16384 8192 4096 2048 1024 514
aver
age
runn
ing
time
rela
tive
to S
T-V
vertices
TOP-WTOP-S
ST-VLIN-V
Layered networks:
– 4 rows, bn/4c columns between s and t;
– each vertex connected to 3 random vertices in the next column;
– augmenting paths have Ω(n) arcs.
![Page 93: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/93.jpg)
Maximum Flow on Square Meshes
•
32
16
8
4
2
1
1/2
1/4
1/8 65536 32768 16384 8192 4096 2048 1024 514
aver
age
runn
ing
time
rela
tive
to S
T-V
vertices
TOP-WTOP-S
ST-VLIN-V
Square meshes:
– full b√nc × b√nc grid between s and t;
– each grid vertex connected to all 4 neighbors;
– augmenting paths have Ω(√
n) arcs.
![Page 94: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/94.jpg)
Experiment: Online Minimum Spanning Forest
• Online minimum spanning forest:
– Edges processed one at a time;
– Edge (v, w) inserted if
∗ v and w in different components; or
∗ (v, w) is shorter than longest edge on path from v to w:
· longest edge is removed.
– O(log n) time per edge.
• Kruskal as reference algorithm:
1. Quicksort all m edges (offline);
2. Insert edge iff its endpoints are in different components:
– use union-find data structure.
![Page 95: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/95.jpg)
Online MSF on Random Graphs
•
32
28
24
20
16
12
8
4
010485765242882621441310726553632768163848192
micr
osec
onds
per
edg
e
number of edges
TOP-WTOP-S
ST-ELIN-E
KRUSKAL
Random multigraphs:
– n = 4096, edges with random endpoints and weights;
– expected diameter: O(log n);
– more edges ⇒ greater percentage of exposes.
![Page 96: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/96.jpg)
Online MSF on Augmented Stars
• Augmented stars:
– n = 65537, varying number (and length) of spokes;
– diameter: O(65537/#spokes);
– spoke edges, with length 1, processed first;
– other edges (random), with length 2, processed later;
– 10n edges in total.
![Page 97: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/97.jpg)
Online MSF on Augmented Stars
•
35
30
25
20
15
10
5
0 65536 8192 1024 128 16 2
micr
osec
onds
per
edg
e
number of spokes
TOP-STOP-W
ST-ELIN-E
KRUSKAL
Augmented stars:
– n = 65537, varying number (and length) of spokes;
– diameter: O(65537/#spokes).
![Page 98: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/98.jpg)
Online MSF and Cache Effects
•
0
5
10
15
20
25
65536 16384 4096 1024 256 64 16 4 1
micr
osec
onds
per
edg
e
components
TOP-WTOP-S
ST-ELIN-E
KRUSKAL
Procedure:
– Partition vertices at random into n/32 components of size 32;
– Random edges: pick random component, then random pair within it.
– Total number of edges: 4n.
![Page 99: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/99.jpg)
Experiment: Shortest Paths
• Bellman’s single source shortest path algorithm:
– Assign distance label to each vertex.
∗ initially, d(s)← 0 (source) and d(v)←∞ (remaining vertices).
– In each iteration, process all arcs (v, w) in fixed order:
∗ if d(w) < d(v) + `(v, w), relax (v, w):
∗ decrement d(w) by ∆ = d(v) + `(v, w)− d(w).
– Stop when an iteration does not relax any arc.
– Running time: O(mn).
• Dynamic trees:
– Maintain the current shortest path tree and current d(·);– When relaxing (v, w), decrement d(·) for all descendants of w;
– O(mn log n), but may require fewer iterations.
![Page 100: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/100.jpg)
Experiment: Shortest Paths
•
0
5
10
15
20
25
30
35
40
45
65536 16384 4096 1024 256 64
micr
osec
onds
per
edg
e pe
r ite
ratio
n
vertices
TOP-WTOP-S
ET-SBELLMAN
Random graph with Hamiltonian cycle:
– n arcs on Hamiltonian cycle with weight in [1;10].
– 3n random arcs with weight [1;1000].
– Edges processed in random order.
![Page 101: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/101.jpg)
Experiment: Shortest Paths
•
0
5
10
15
20
25
30
35
40
45
65536 16384 4096 1024 256 64
micr
osec
onds
per
edg
e pe
r ite
ratio
n
vertices
TOP-WTOP-S
ET-SBELLMAN
Random graph with Hamiltonian cycle:
– Dynamic trees reduce #iterations by 60% to 75%...
– ...but increases running times by a factor of at least 50.
![Page 102: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/102.jpg)
Outline
• The Dynamic Trees problem
• Existing data structures
• A new worst-case data structure
• A new amortized data structure
• Experimental results
⇒ Final remarks
![Page 103: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/103.jpg)
Summary
• Main contributions:
– new worst-case data structure;
– new self-adjusting data structure:
∗ uses contraction and path decomposition.
– experimental analysis.
• Future work and open problems:
– Worst-case data structure: do we really need Euler tours?
– Self-adjusting data structure: can we make it worst-case?
– Hybrid data structure?
– Extend top trees?
– Generalize top trees (grids, planar graphs, ...)?
![Page 104: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/104.jpg)
Thank You
![Page 105: Design and Analysis of Data Structures for Dynamic Treesloukas/courses/grad/Data_Structures... · Data Structures for Dynamic Trees Di erent applications require di erent operations](https://reader036.vdocument.in/reader036/viewer/2022081402/5f0bde347e708231d4329bf5/html5/thumbnails/105.jpg)
Main Approaches
Top Trees ST-trees
principle tree contraction path decomposition
general interface YES NO
unrestricted trees YES NO
representation level-based recursive
overhead HIGH LOWer