Professional Documents
Culture Documents
CONTENTS
2
INTRODUCTION.
BASIC OPERATIONS.
COMPLEXITIES INVOLVED. CONCLUSION.
5/1/2012
INTRODUCTION
3
and King and are an alternative to link-cut trees for representing dynamic trees. Euler tour trees are simpler and easier to analyze than link-cut trees. Euler tour trees do not naturally store aggregate information about paths in the tree. Euler tour trees are well suited for storing aggregate information on sub trees.
5/1/2012
tour of the tree. In an arbitrary graph, an Euler tour is a path that traverses each edge exactly once. For trees we say that each edge is bidirectional, so the Euler tour of a tree is the path through the tree that begins at the root and ends at the root, traversing each edge exactly twice once to enter the sub tree, and once to exit it. The Euler tour of a tree is essentially the depth first traversal of a tree that returns to the root at the end.
5/1/2012
AN EXAMPLE
5
5/1/2012
5/1/2012
5/1/2012
5/1/2012
G C F
5/1/2012
STORING INFORMATION
10
represented tree in a balanced binary search tree (BST). For some represented tree, each visit to a node in that tree's Euler tour corresponds to a node in the BST. Each node in the represented tree holds pointers to the nodes in the BST representing the first and the last times it was visited.
5/1/2012
STORING INFORMATION
11
G GB R
R A B
C D
5/1/2012
STORING INFORMATION
12
of visitations starting and ending at the root. Pointers from that sequence point to the node, and pointers from the node point to the first and last visitations. In the last figure pointers relating to root is shown.
5/1/2012
BASIC OPERATIONS
13
FINDING ROOT: FindRoot(v). Find the root of the tree containing node v. In the Euler tour of a tree, the root is visited first and last. Therefore we simply return the minimum or maximum element in the BST.
5/1/2012
BASIC OPERATIONS
14
CUTTING OF A SUBTREE. Cut the sub tree rooted at v from the rest of the tree. The Euler tour of v's sub tree is a contiguous subsequence of visits that starts and ends with v, contained in the sequence of visits for the whole tree. To cut the sub tree rooted at v, we may simply split the BST before its first and after its last visit to v. This splitting gives us the Euler tour of the tree before reaching v, the tour of v's sub tree, and the tour of the tree after leaving v.
5/1/2012
BASIC OPERATIONS
15
CUTTING OF A SUBTREE. Concatenating the first and last pieces together, and possibly deleting one redundant visitation between the end of the first piece and beginning of the last, gives us our answer.
5/1/2012
BASIC OPERATIONS
16
INSERT US SUBTREE AS A CHILD OF V Link(u, v). Insert u's sub tree as a child of v. In the resulting Euler tour, we need to traverse u's sub tree immediately after and immediately before visits to v. Therefore we will split v's traversal before the last visit to v, and then concatenate onto the left piece a singleton visit to v, followed by the Euler tour of u's sub tree, followed by the right piece.
5/1/2012
17
a b m l i k c d e f h g
17 5/1/2012
(p o) (o n) (n n) (n o) (o o) (o p) (p p) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a)
18
a b m l i k c d e f h g
18 5/1/2012
(p o) (o n) (n n) (n o) (o o) (o p) (p p) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a)
19
(p o) (o n) (n n) (n o) (o o) (o p) (p p) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a) (o p) (p p) (p o) (o n) (n n) (n o) (o o)
j
a b m l i k c d e f h g
19 5/1/2012
(l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l)
20
(o p) (p p) (p o) (o n) (n n) (n o) (o o) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l)
a b m l i k c d e f h g
20 5/1/2012
(o p) (p p) (p o) (o n) (n n) (n o) (o o) (o l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l o)
a b m l i k c d e f h g
21
(p o) (o n) (n n) (n o) (o o) (o p) (p p) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a)
a b m l i k c d e f h g
22
(p o) (o n) (n n) (n o) (o o) (o p) (p p) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a)
a b m l i k c d e f h g
23
(p o) (o n) (n n) (n o) (o o) (o p) (p p) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a)
a b m l i k c d e f h g
24
(p o) (o n) (n n) (n o) (o o) (o p) (p p) (a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a)
(p o) (o n) (n n) (n o) (o o) (o p) (p p)
a b m l i k c d e f h g
25
(a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h i) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) (i h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a)
(a a) (a b) (b b) (b c) (c d) (d d) (d e) (e e) (e f) (f f) (f g) (g g) (g h) (h h) (h g) (g f) (f e) (e d) (d c) (c c) (c b) (b m) (m m) (m b) (b a) (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i)
COMPLEXITIES INVOLVED
26
number of search, split, and merge operations on the Euler tour tree. Each of these operations takes O(log n) per operation on a balanced BST data structure. Consequently, the total running time for Euler-Tour trees is O(log n) per operation.
5/1/2012
CONCLUSION
27
regarding the graph. Euler tour trees can be used to achieve dynamic connectivity in general graphs in time. Used to store aggregate information about the sub trees.
5/1/2012