Skip to main content
Log in

Two-level heaps: a new priority queue structure with applications to the single source shortest path problem

  • Published:
Computing Aims and scope Submit manuscript

Abstract

The single source shortest paths problem with positive edge weights (SSSPP) is one of the more widely studied problems in operations research and theoretical computer science, on account of its wide applicability to practical situations. This problem was first solved in polynomial time by Dijkstra, who showed that by extracting vertices with the smallest distance from the source and relaxing its outgoing edges, the shortest path to each vertex is obtained. Variations of this general theme have led to a number of algorithms which work well in practice. At the heart of a Dijkstra implementation is the technique used to implement a priority queue. It is well known that using Dijkstra’s approach requires Ω(n log n) steps on a graph having n vertices, since it essentially sorts vertices based on their distances from the source. Accordingly, the fastest implementation of Dijkstra’s algorithm on a graph with n vertices and m edges should take Ω(m + n · log n) time, and consequently, the Dijkstra procedure for SSSPP using Fibonacci Heaps is optimal in the comparison-based model. In this paper, we introduce a new data structure to implement priority queues called two-level heap (TLH) and a new variant of Dijkstra’s algorithm called Phased Dijkstra. We contrast the performance of Dijkstra’s algorithm (both the simple and the phased variants) using a number of data structures to implement the priority queue and empirically establish that TLH are far superior to Fibonacci heaps on every graph family considered. It is to be noted that our profiling includes both sparse and dense graphs.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

Explore related subjects

Discover the latest articles, news and stories from top researchers in related subjects.

References

  1. Ahuja RK, Mehlhorn K, Orlin JB, Tarjan RE (1990) Faster algorithms for the shortest path problem. J ACM 37(2): 213–223

    Article  MATH  MathSciNet  Google Scholar 

  2. Brodnik A, Carlsson S, Karlsson J, Ian Munro J (2001) Worst case constant time priority queue. In: Proceedings of the twelfth annual ACM-SIAM symposium on discrete algorithms (SODA-01), pp 523–528. ACM Press, New York

  3. Chakrabarti D, Zhan Y, Faloutsos C (2004) R-MAT: a recursive model for graph mining. In: Proceedings of 4th SIAM international conference on data mining, FL, USA

  4. Cherkassky BV, Goldberg AV, Radzik T (1996) Shortest paths algorithms: theory and experimental evaluation. Math Program 73: 129–174

    MathSciNet  Google Scholar 

  5. Cormen TH, Leiserson CE, Rivest RL, Stein C (2001) Introduction to algorithms. MIT Press, USA

    MATH  Google Scholar 

  6. Costa LA, Geiger D, Gupta A, Vlontozos J (1995) Dynamic programming for detecting, tracking and matching elastic contours. IEEE Trans Pattern Anal Mach Intell 17(3): 294–302

    Article  Google Scholar 

  7. Cox IJ, Rao SB, Zhong Y (1996) Ration regions: a technique for image segmentation. In: Proceedings of the international conference on pattern recognition, pp 557–564

  8. Demetrescu C, Goldberg AV, Johnson D (2005) 9th DIMACS implementation challenge: shortest paths. http://www.dis.uniroma1.it/~challenge9/

  9. Dijkstra EW (1959) A note on two problems in connexion with graphs. Numer Math 1: 269–271

    Article  MATH  MathSciNet  Google Scholar 

  10. Frederickson GN (1987) Fast algorithms for shortest paths in planar graphs, with applications. SIAM J Comput 16(6): 1004–1022

    Article  MATH  MathSciNet  Google Scholar 

  11. Goldberg AV (1996) Network optimization library. http://www.avglab.com/andrew/soft.html

  12. Goldberg AV (2001) Shortest path algorithms: engineering aspects. In: ISAAC 2001: Proceedings 12th international symposium on algorithms and computation, pp 502–513. Springer, London

  13. Johnson DB (1977) Efficient algorithms for shortest paths in sparse networks. J ACM 24(1): 1–13

    Article  MATH  Google Scholar 

  14. LaMarca A, Ladner RE (1996) The influence of caches on the performance of heaps. ACM JEA 1(4). http://www.jea.acm.org/1996/LaMarcaInfluence/

  15. Meyer U (2001) Single-source shortest-paths on arbitrary directed graphs in linear average-case time. In: Proceedings of the twelfth annual ACM-SIAM symposium on discrete algorithms (SODA-01), pp 797–806. ACM Press, New York

  16. Oberhauser G, Simha R (1995) Fast data structures for shortest path routing: a comparative evaluation. In: Proceedings of IEEE conference communications, vol 95, pp 1597–1601, Seattle, WA, June 1995

  17. Park J, Penner M, Prasanna VK (2002) Optimizing graph algorithms for improved cache performance. In: Proceedings of international parallel and distributed processing symposium (IPDPS 2002), Fort Lauderdale, FL, April 2002

  18. Ramalingam G, Reps TW (1996) An incremental algorithm for a generalization of the shortest-path problem. J Algorithm 21(2): 267–305

    Article  MATH  MathSciNet  Google Scholar 

  19. Ramalingam G, Reps TW (1996) On the computational complexity of dynamic graph problems. Theor Comput Sci 158(1, 2): 233–277

    Article  MATH  MathSciNet  Google Scholar 

  20. Raman R (1997) Recent results in single-source shortest paths problem. SIGACT News 28: 81–87

    Article  Google Scholar 

  21. Raman R (1996) Priority queues: small, monotone and trans-dichotomous. In: ESA, pp 121–137

  22. Sanders P (2000) Fast priority queues for cached memory. ACM JEA 5(7). http://www.jea.acm.org/2000/SandersPriority/

  23. Subramani K, Kovalchick L (2005) A greedy strategy for detecting negative cost cycles in networks. Future Generat Comput Syst 21(4): 607–623

    Article  Google Scholar 

  24. Thorup M (1997) Undirected single source shortest path in linear time. In: Proceedings of the 38th annual symposium on foundations of computer science (FOCS-97), pp 12–21. IEEE Computer Society Press, Los Alamitos, October 20–22, 1997

  25. Thorup M (1996) On RAM priority queues. In: Proceedings of the 7th annual ACM-SIAM symposium on discrete algorithms, SODA’96 (Atlanta, Georgia, January 28–30, 1996), pp 59–67. ACM SIGACT, SIAM, Society for Industrial and Applied Mathematics, Philadelphia, PA

  26. Wang C, Ivancic F, Ganai MK, Gupta A (2005) Deciding separation logic formulae by sat and incremental negative cycle elimination. In: LPAR, pp 322–336

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to K. Subramani.

Additional information

Communicated by C.C. Douglas.

This research was supported in part by a research grant from the Air-Force Office of Scientific Research under contract FA9550-06-1-0050, by the National Science Foundation through Award CCF-0827397, and by the DOE Office of Advanced Scientific Computing Research under contract number DE-AC02-05CH11231.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Subramani, K., Madduri, K. Two-level heaps: a new priority queue structure with applications to the single source shortest path problem. Computing 90, 113–130 (2010). https://doi.org/10.1007/s00607-010-0112-1

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00607-010-0112-1

Keywords

Mathematics Subject Classification (2000)