, Volume 73, Issue 3, pp 547–570 | Cite as

A Faster Computation of All the Best Swap Edges of a Shortest Paths Tree

  • Davide Bilò
  • Luciano Gualà
  • Guido ProiettiEmail author


We consider a two-edge connected, non-negatively real-weighted graph G with n vertices and m edges, and a single-source shortest paths tree (SPT) of G rooted at an arbitrary vertex. If an edge of the SPT is temporarily removed, a widely recognized approach to reconnect the vertices disconnected from the root consists of joining the two resulting subtrees by means of a single non-tree edge, called a swap edge. This allows to reduce consistently the set-up and computational costs which are incurred if one instead rebuilds a new optimal SPT from scratch. In the past, several optimality criteria have been considered to select a best possible swap edge, and here we restrict our attention to arguably the two most significant measures: the minimization of either the maximum or the average distance between the root and the disconnected vertices. For the former criteria, we present an \(O(m \log \alpha (m,n))\) time algorithm—where \(\alpha \) is the inverse of the Ackermann function—to find a best swap edge for every edge of the SPT, thus improving onto the previous \(O(m \log n)\) time algorithm. Concerning the latter criteria, we provide an \(O(m+n \log n)\) time algorithm for the special but important case where G is unweighted, which compares favourably with the \(O\left( m+n \, \alpha (n,n)\log ^2n\right) \) time bound that one would get by using the fastest algorithm known for the weighted case—once this is suitably adapted to the unweighted case.


Single-source shortest paths tree Edge fault tolerance Swap algorithms 



This work was partially supported by the Research Grant PRIN 2010 “ARS TechnoMedia” (Algorithms for Techno-Mediated Social Networks), funded by the Italian Ministry of Education, University, and Research.


  1. 1.
    Ackermann, W.: Zum hilbertschen aufbau der reellen zahlen. Math. Ann. 99, 118–133 (1928)zbMATHMathSciNetCrossRefGoogle Scholar
  2. 2.
    Bilò, D., Gualà, L., Proietti, G.: Finding best swap edges minimizing the routing cost of a spanning tree. Algorithmica 68(2), 337–357 (2014)zbMATHMathSciNetCrossRefGoogle Scholar
  3. 3.
    Bilò, D., Gualà, L., Proietti, G.: A faster computation of all the best swap edges of a shortest paths tree, Proceedings of the 21st Annual European Symposium on Algorithms (ESA’13), Sophia Antipolis, France, vol. 8125. Lecture Notes in Computer Science, pp. 157–168. Springer, Berlin (2013)Google Scholar
  4. 4.
    Brodal, G.S., Lagogiannis, G., Tarjan, R.E.: Strict Fibonacci heaps. Proceedings of the 44th Symposium on Theory of Computing (STOC’12), pp. 1177–1184. ACM Press (2012)Google Scholar
  5. 5.
    Brodal, G.S., Jacob, R.: Dynamic planar convex hull. Proceedings of the 43rd Symposium on Foundations of Computer Science (FOCS’02), pp. 617–626 . IEEE Computer Society (2002)Google Scholar
  6. 6.
    Di Salvo, A., Proietti, G.: Swapping a failing edge of a shortest paths tree by minimizing the average stretch factor. Theor. Comput. Sci. 383(1), 23–33 (2007)zbMATHCrossRefGoogle Scholar
  7. 7.
    Fredman, M.L., Tarjan, R.E.: Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM 34(3), 596–615 (1987)MathSciNetCrossRefGoogle Scholar
  8. 8.
    Gfeller, B.: Faster swap edge computation in minimum diameter spanning trees. Algorithmica 62(1–2), 169–191 (2012)zbMATHMathSciNetCrossRefGoogle Scholar
  9. 9.
    Gualà, L., Proietti, G.: Exact and approximate truthful mechanisms for the shortest-paths tree problem. Algorithmica 49(3), 171–191 (2007)zbMATHMathSciNetCrossRefGoogle Scholar
  10. 10.
    Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)zbMATHMathSciNetCrossRefGoogle Scholar
  11. 11.
    Italiano, G.F., Ramaswami, R.: Maintaining spanning trees of small diameter. Algorithmica 22(3), 275–304 (1998)zbMATHMathSciNetCrossRefGoogle Scholar
  12. 12.
    Ito, H., Iwama, K., Okabe, Y., Yoshihiro, T.: Polynomial-time computable backup tables for shortest-path routing. Proceedings of the 10th International Colloquium on Structural Information and Communication Complexity (SIROCCO’03), vol. 17. Proceedings in Informatics, Carleton Scientific, pp. 163–177 (2003)Google Scholar
  13. 13.
    Nardelli, E., Proietti, G., Widmayer, P.: How to swap a failing edge of a single source shortest paths tree. Proceedings of the 5th International Computing and Combinatorics Conference (COCOON’99), vol. 1627. Lecture Notes in Computer Science, pp. 144–153 . Springer, Berlin, (1999)Google Scholar
  14. 14.
    Nardelli, E., Proietti, G., Widmayer, P.: Finding all the best swaps of a minimum diameter spanning tree under transient edge failures. J. Graph Algorithms Appl. 5(5), 39–57 (2001)zbMATHMathSciNetCrossRefGoogle Scholar
  15. 15.
    Nardelli, E., Proietti, G., Widmayer, P.: Swapping a failing edge of a single source shortest paths tree is good and fast. Algorithmica 36(4), 361–374 (2003)MathSciNetCrossRefGoogle Scholar
  16. 16.
    Pettie, S.: Sensitivity analysis of minimum spanning trees in sub-inverse-Ackermann time. Proceedings of the 16th International Symposium on Algorithms and Computation (ISAAC’05), vol. 3827. Lecture Notes in Computer Science, pp. 964–973. Springer, Berlin (2005)Google Scholar
  17. 17.
    Proietti, G.: Dynamic maintenance versus swapping: an experimental study on shortest paths trees, Proceedings of the 3rd Workshop on Algorithm Engineering (WAE 2000), vol. 1982. Lecture Notes in Computer Science, pp. 207–217. Springer, Berlin (2000)Google Scholar
  18. 18.
    Tarjan, R.E.: Sensitivity analysis of minimum spanning trees and shortest path trees. Inf. Process. Lett. 14(1), 30–33 (1982)MathSciNetCrossRefGoogle Scholar
  19. 19.
    Wu, B.Y., Hsiao, C.-Y., Chao, K.-M.: The swap edges of a multiple-sources routing tree. Algorithmica 50(3), 299–311 (2008)zbMATHMathSciNetCrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  1. 1.Dipartimento di Scienze Umanistiche e SocialiUniversity of SassariSassariItaly
  2. 2.Dipartimento di Ingegneria dell’ImpresaUniversity of Rome “Tor Vergata”RomeItaly
  3. 3.Dip. di Ingegneria e Scienze dell’Informazione e MatematicaUniv. of L’AquilaL’AquilaItaly
  4. 4.Istituto di Analisi dei Sistemi ed InformaticaCNRRomeItaly

Personalised recommendations