1 / 15

Euler tour trees

Euler tour trees. Maintain a forest under the operations: link(v w) cut(v,w) find-tree(v) find-min-val(T) change-val(v,x) add-val(T,x). p. o. n. a. b. m. c. . k. l. d. i. e. (p o) (o n) (n n) (n o) (o o) (o p) (p p). j. f.

rosina
Download Presentation

Euler tour trees

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Euler tour trees

  2. Maintain a forest under the operations: link(v w) cut(v,w) find-tree(v) find-min-val(T) change-val(v,x) add-val(T,x)

  3. p o n a b m c  k l d i e (p o) (o n) (n n) (n o) (o o) (o p) (p p) j f (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) h g

  4. p o n a b m c  k l d i e (p o) (o n) (n n) (n o) (o o) (o p) (p p) j f (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) h g

  5. p o n (p o) (o n) (n n) (n o) (o o) (o p) (p p) 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 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) b m c k l d i (o p) (p p) (p o) (o n) (n n) (n o) (o o) e j f (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) h g

  6. p o n (o p) (p p) (p o) (o n) (n n) (n o) (o o) a (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) b m c k l d i e (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) j f h g

  7. p o n a b m c  k l d i e (p o) (o n) (n n) (n o) (o o) (o p) (p p) j f (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) h g

  8. p o n a b m c  k l d i e (p o) (o n) (n n) (n o) (o o) (o p) (p p) j f (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) h g

  9. p o n a b m c  k l d i e (p o) (o n) (n n) (n o) (o o) (o p) (p p) j f (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) h g

  10. p o n a b m c  k l d i e (p o) (o n) (n n) (n o) (o o) (o p) (p p) j f (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) h g

  11. p o n (p o) (o n) (n n) (n o) (o o) (o p) (p p) 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 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) b m c k l d i e (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) j f h (i i) (i k) (k k) (k i) (i l) (l l) (l i) (i j) (j j) (j i) g

  12. Link + cut • Linked lists would do. • What about finding the list containing a vertex ? • What about vertex values ?

  13. Search trees • Represent the lists as search trees.

  14. p o n a b (p o) (o n) (n n) (n o) (o o) (o p) (p p) m c k l d i e j f (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) h g

  15. So we can easily do link(v,w) : assume v and w are in different trees cut(v,w) : assume v and w are adjacent in a tree findtree(v) In logarithmic time What about vertex values ? Store with each node the minimum value in its subtree

More Related