In general, a priority queue will be quicker at finding the vertex v with minimum cost, but will entail more expensive updates when the value of C changes. This choice leads to differences in the time complexity of the algorithm. The algorithm may be modified to start with any particular vertex s by setting C to be a number smaller than the other values of C (for instance, zero), and it may be modified to only find a single spanning tree rather than an entire spanning forest (matching more closely the informal description) by stopping whenever it encounters another vertex flagged as having no associated edge.ĭifferent variations of the algorithm differ from each other in how the set Q is implemented: as a simple linked list or array of vertices, or as a more complicated priority queue data structure.
0 Comments
Leave a Reply. |