Method incidentedges is called once for each vertex

This preview shows page 15 - 17 out of 17 pages.

Method incidentEdges is called once for each vertex Label operations We set/get the distance, parent and locator labels of vertex  z   O (deg( z ))   times Setting/getting a label takes  O (1)  time Priority queue operations Each vertex is inserted once into and removed once from the priority  queue, where each insertion or removal takes  O (log n ) time The key of a vertex  w  in the priority queue is modified at most  deg( w ) times, where each key change takes  O (log n ) time  Prim-Jarnik’s algorithm runs in  O (( n + m ) log n )  time provided the  graph is represented by the adjacency list structure Recall that  Σ v deg( v ) = 2 m The running time is  O ( m log n )  since the graph is connected
Image of page 15

Subscribe to view the full document.

©  2010 Goodrich, Tamassia Minimum Spanning Trees 16 Baruvka’s Algorithm (Exercise) Like Kruskal’s Algorithm, Baruvka’s algorithm grows many  clusters at once and maintains a forest  T Each iteration of the while loop halves the number of connected  components in forest  T The running time is  O ( m log n ) Algorithm BaruvkaMST ( G ) T V {just the vertices of G } while T has fewer than n - 1 edges do for each connected component C in T do Let edge e be the smallest-weight edge from C to another component in T if e is not already in T then Add edge e to T return T
Image of page 16
©  2010 Goodrich, Tamassia Example of Baruvka’s  Algorithm (animated) CSC 316 17 1 5 4 3 2 3 4 4 9 6 8 7 6 5 4 9 6 8 Slide by Matt Stallmann  included with permission. Slide by Matt Stallmann  included with permission. 1 5 4 3 2 3 4 4 9 6 8 7 6 5
Image of page 17
  • Fall '09
  • Vertex, Tamassia, Minimum Spanning Trees

{[ snackBarMessage ]}

Get FREE access by uploading your study materials

Upload your study materials now and get free access to over 25 million documents.

Upload now for FREE access Or pay now for instant access
Christopher Reinemann
"Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

Ask a question for free

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern