1 / 38

Greedy Algorithm to Find Minimum Length Triangulation

Greedy Algorithm to Find Minimum Length Triangulation. CSC6520 Algorithm Graduate Student Project Instructor : Dr. Alexander Zelikovsky Student : Yan Liu Spring 2001. Introduction. Definition of Triangulation

louisal
Download Presentation

Greedy Algorithm to Find Minimum Length Triangulation

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. GreedyAlgorithm to Find Minimum Length Triangulation CSC6520 Algorithm Graduate Student Project Instructor : Dr. Alexander ZelikovskyStudent : Yan Liu Spring 2001

  2. Introduction • Definition of Triangulation -- a set T of chords of a convex polygon P that divide the polygon into disjoint triangles. • Minimum length triangulation(MLT) -- Given a convex polygon P=(v1, …, vn) -- Form Triangles by sides and chords of P. -- Find a triangulation that minimizes the sum of the lengths of the triangles in the triangulations.

  3. Example of triangulating a convex polygon v7 v7 v1 v1 v6 v6 v2 v2 v5 v5 v3 v3 v4 v4 Figure 1. Two ways of triangulating a convex polygon.

  4. Data Structure • Heap – a complete binary tree to hold all of diagonals. -- Build-Heap(E) -- Heapify (E, i) • HeapSort algorithm -- to get the minimum length triangulation. • Remove diagonals from set E. -- Heap-delete(E,i) • Add new diagonals -- Heap-Insert(E)

  5. Algorithms for MLT • Given a convex polygon P(v1…vn) • Find the minimum length triangulation for P(v1…vn) • Algorithms -- Greedy-1 Algorithm -- Greedy Algorithm

  6. Greedy-1 Algorithm for MLT • Step 1. Put all of vertices of convex polygon P into set V. • Step 2. Put all of next-neighbor diagonals into set E. For example, (k, k+2) is the next-neighbor diagonal between the vertices vk and vk+2. • Step 3. Find the minimum diagonal (k, k+2) in E, and insert it into the result set M of the minimum length triangulation of the convex polygon P.

  7. Greedy-1 Algorithm for MLT -- continue • Step 4. Remove the vertex vk+1from set V. • Step 5. Remove all diagonals which are related to the removed vertex in set V in the last step. • Step 6. Update E to add unexisted next- neighbor diagonals for the verticesvk and vk+2 such as (k, k+3), (k+2, k-1). • Step 7. Check if E is NOT empty, go back step 3 to repeat; otherwise return the result M.

  8. Example for Greedy – 1 Algorithm v7 v1 v6 v2 v5 v4 v3 E={ (1,3), (2,4),(3,5),(4,6), (5,7), (6,1), (7,2)} V={v1, v2,v3,v4,v5,v6,v7} M= Ø

  9. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={(1,3), (2,4),(3,5),(4,6), (5,7), (6,1)} V={v1, v2,v3,v4,v5,v6,v7} M={(7, 2)}

  10. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={ (1,3),(1,6),(2,4),(3,5),(4,6), (5,7)} V={v2,v3,v4,v5,v6,v7} M={(7, 2)}

  11. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={(2,4),(3,5),(4,6), (5,7)} V={v2,v3,v4,v5,v6,v7} M={(7, 2)}

  12. Example for Greedy – 1 Algorithm --continue v7 Add new next diagonals v1 v6 v2 v5 v3 v4 E={(2,4),(3,5),(4,6), (5,7), (6,2), (7,3)} V’={v2,v3,v4,v5,v6,v7} M={(7, 2)}

  13. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={(2,4),(3,5),(4,6), (6,2), (7,3)} V={v2,v3,v4,v5,v6,v7} M={(7, 2), (5,7)}

  14. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={(2,4),(3,5), (4,6), (6,2), (7,3)} V={v2,v3,v4,v5,v6,v7} M={(7, 2), (5,7) }

  15. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={(2,4),(3,5), (7,3)} V={v2,v3,v4,v5,v7} M={(7, 2), (5,7)}

  16. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 Add new next-diagonals v3 v4 E={(2,4),(3,5), (7,3), (5, 2),(7,4)} V={ v2,v3,v4,v5,v7} M={(7, 2), (5,7)}

  17. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={(3,5), (5, 2),(7,3), (7,4)} V={ v2,v3,v4,v5,v7} M={(7, 2), (5,7), (2,4)}

  18. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={(3,5), (7,3), (5, 2),(7,4)} V={ v2,v3,v4,v5,v7} M={(7, 2), (5,7), (2,4)}

  19. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={ (5, 2), (7,4)} V={ v2,v4,v5,v7} M={(7, 2), (5,7),(2,4)}

  20. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={ (v5, v2)}V={ v2,v4,v7} M={(7, 2), (5,7),(2,4), (4,7)}

  21. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E={(v5, v2)}V={ v2,v4,v7} M={(7, 2), (5,7),(2,4), (4,7)}

  22. Example for Greedy – 1 Algorithm --continue v7 v1 v6 v2 v5 v3 v4 E= Ø V={ v2,v4,v7} M={(7, 2), (5,7),(2,4), (4,7)}

  23. Greedy Algorithm for MLT • Step 1. Insert all diagonals between any two vertices (exclude any two neighbor vertices on the polygon P) into set E. For example, (i, j) is the diagonal between the vertices v i and v j.

  24. Greedy Algorithm for MLT -- continue • Step 2. Find the minimum diagonal in E and insert it into the result set M of the minimum length triangulation for graph G. • Step 3.Remove those diagonals from E, which cross the chosen minimum diagonal in the last step. • Step 4. Check if E is NOT empty, go back step 2 to repeat; otherwise return the result M.

  25. Example for Greedy Algorithm v7 v1 v6 v2 v5 v4 v3 E={(1,3), (1,4), (1,5), (1,6), (2,4),(2,5),(2,6), (2,7), (3,5),(3,6), (3,7),(4,6), (5,7), (4,6), (4,7) } M= Ø

  26. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(1,3), (1,4), (1,5), (1,6), (2,4),(2,5),(2,6), (2,7), (3,5),(3,6), (3,7),(5,7), (4,7) } M= {(4,6)}

  27. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(1,3), (1,4), (1,5), (1,6), (2,4), (2,5), (v2,v6), (2,7), (3,5), (3,6), (3,7), (5,7), (4,7)} M= {(4,6)}

  28. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(1,3), (1,4), (1,6), (2,4), (2,6), (2,7), (3,6), (3,7),(4,7)} M= { (4,6) }

  29. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(1,3), (1,4), (1,6), (2,4), (2,6), (3,6), (3,7), (4,7) } M= {(4,6), (2,7)}

  30. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(1,3), (1,4), (1,6), (2,4), (2,6), (3,6), (3,7), (4,7) } M= {(4,6), (2,7) }

  31. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(2,4), (2,6), (3,6), (3,7), (4,7)} M= {(4,6), (2,7)}

  32. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(2,6), (3,6), (3,7), (4,7)} M= {(4,6), (2,7),(2,4)}

  33. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(2,6), (3,6), (3,7), (4,7)} M= {(4,6), (2,7),(2,4)}

  34. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(2,6), (4,7)} M={(4,6), (2,7),(2,4)}

  35. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(4,7)} M= {(4,6), (2,7),(2,4), (2,6)}

  36. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E={(4,7)} M= {(4,6), (2,7),(2,4), (2,6)}

  37. Example for Greedy Algorithm --continue v7 v1 v6 v2 v5 v4 v3 E= Ø M= {(4,6), (2,7),(2,4), (2,6)}

  38. Summary • Performance -- Greedy algorithm is between O(n^2) and O(n^3) -- Greedy-1 algorithm is O(nlgn) • Result of MLT -- For a convex polygon P(V), using different algorithms may get different results.

More Related