An empirical analysis of algorithms for constructing a minimum spanning tree

  • Bernard M. E. Moret
  • Henry D. Shapiro
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 519)


We compare algorithms for the construction of a minimum spanning tree through largescale experimentation on randomly generated graphs of different structures and different densities. In order to extrapolate with confidence, we use graphs with up to 130,000 nodes (sparse) or 750,000 edges (dense). Algorithms included in our experiments are Prim's algorithm (implemented with a variety of priority queues), Kruskal's algorithm (using presorting or demand sorting), Cheriton and Tarjan's algorithm, and Fredman and Tarjan's algorithm. We also ran a large variety of tests to investigate low-level implementation decisions for the data structures, as well as to enable us to eliminate the effect of compilers and architectures.

Within the range of sizes used, Prim's algorithm, using pairing heaps or sometimes binary heaps, is clearly preferable. While versions of Prim's algorithm using efficient implementations of Fibonacci heaps or rank-relaxed heaps often approach and (on the densest graphs) sometimes exceed the speed of the simpler implementations, the code for binary or pairing heaps is much simpler, so that these two heaps appear to be the implementation of choice.

Some conclusions regarding implementation of priority queues also emerge from our study: in the context of a greedy algorithm, pairing heaps appear faster than other implementations, closely followed by binary, rank-relaxed and Fibonacci heaps, the latter two implemented with sacks, while splay trees finish a decided last.


Minimum Span Tree Priority Queue Sparse Graph Dense Graph Adjacency List 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    Cheriton, D., and R.E. Tarjan, “Finding minimum spanning trees,” SIAM J. Comput. 5 (1976), pp. 724–742.Google Scholar
  2. [2]
    Driscoll, J.R., H.N. Gabow, R. Shrairman, and R.E. Tarjan, “Relaxed heaps: an alternative to Fibonacci heaps with applications to parallel computation,” Comm. ACM 11 (1988), pp. 1343–1354.Google Scholar
  3. [3]
    Fredman, M.L., R. Sedgewick, D.D. Sleator, and R.E. Tarjan, “The pairing heap: a new form of self-adjusting heap,” Algorithmica 1 (1986), pp. 111–129.Google Scholar
  4. [4]
    Fredman, M.L., and R.E. Tarjan, “Fibonacci heaps and their use in improved network optimization algorithms,” Proc. 25th Ann. IEEE Symp. Foundations Comput. Sci. FOCS-84, pp. 338–346; also in final form in J. ACM 34 (1987), pp. 596–615.Google Scholar
  5. [5]
    Fredman, M.L., and D.E. Willard, “Trans-dichotomous algorithms for minimum spanning trees and shortest paths,” Proc. 31st Ann. IEEE Symp. Foundations Comput. Sci. FOCS-90, pp. 719–725.Google Scholar
  6. [6]
    Gabow, H.N., Z. Galil, T.H. Spencer, and R.E. Tarjan, “Efficient algorithms for minimum spanning trees on directed and undirected graphs,” Combinatorica 6 (1986), pp. 109–122.Google Scholar
  7. [7]
    Graham, R.L., and O. Hell, “On the history of the minimum spanning tree problem,” Ann. Hist. Comput. 7 (1985), pp. 43–57.Google Scholar
  8. [8]
    Jones, D.W. “An empirical comparison of priority-queue and event-set implementations,” Commun. ACM 29 (1986), pp. 300–311.Google Scholar
  9. [9]
    Johnson, D.B., “Priority queues with update and finding minimum spanning trees,” Inf. Process. Lett. 4 (1975), pp. 53–57.Google Scholar
  10. [10]
    Moret, B.M.E., and H.D. Shapiro. Algorithms from P to NP. Volume I: Design and Efficiency. Benjamin-Cummings, Menlo Park, CA, 1991.Google Scholar
  11. [11]
    Sleator, D.D., and R.E. Tarjan, “Self-adjusting binary trees,” Proc. 15th Ann. ACM Symp. Theory Comput. STOC-83, pp. 235–245; also in final form in J. ACM 32 (1985), pp. 652–686.Google Scholar
  12. [12]
    Stasko, J.T., and J.S. Vitter, “Pairing heaps: experiments and analysis,” Commun. ACM 30 (1987), pp. 234–249.Google Scholar
  13. [13]
    Tarjan, R.E. Data Structures and Network Algorithms. SIAM, Philadelphia, 1983.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • Bernard M. E. Moret
    • 1
  • Henry D. Shapiro
    • 1
  1. 1.Department of Computer ScienceUniversity of New MexicoAlbuquerque

Personalised recommendations