Skip to main content
Log in

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

  • Published:
Algorithmica Aims and scope Submit manuscript

Abstract

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.

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

Access this article

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

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4

Similar content being viewed by others

Notes

  1. Notice that for the MST, edge weights can also be negative, and the swap tree is actually an MST of the graph deprived of the failed edge.

  2. Actually, in [6] the authors claim an \(O(m \log ^2 n)\) time bound, but this must be augmented by an \(O(\alpha (m,m))\) factor, as pointed out in [2].

  3. Indeed, we can perform a sensitivity analysis of an MST as follows: (i) we first make the graph \(G\) non-negatively weighted, by summing up to all the edge weights the absolute value of the lightest edge, then (ii) we root the MST at any arbitrary vertex, hence (iii) we set the weight of every edge of the MST to 0, and finally (iv) we solve the ABSE problem w.r.t. the maximum distance from the root. Clearly, for every edge \(e\) of the MST, the best swap edge computed by the algorithm is an edge of minimum weight cycling with \(e\).

  4. Indeed, we can arbitrarily number the tree vertices with different numbers, and then choose, among all paths of equal length starting at \(v'\), the one minimizing the number associated with its endpoint different from \(v'\).

  5. Observe that, if \(z=c_x\), then \(\mathcal{{G}}(x,z)=V(T_{c_x})\); if \(z\ne c_x\), then \(\mathcal{{G}}(x,z)=V(T_{z})\setminus V(T_{v})\), where \(v\) is the (unique) child of \(z\) in \(P(x,c_x)\).

  6. Notice that, from a topological point of view, the \(\mathtt{split}({\mathcal{{S}}},v)\) operation can be viewed as the removal of edge \((r',v)\) from \(T'\).

  7. Observe that a decreasekey operation on \({\mathcal{{S}}_1}\) modifies one group while a split operation on \({\mathcal{{S}}_1}\) splits one group into two groups, i.e., it creates two new groups.

  8. More precisely, each creation, insertion, merge, and findmin operation requires only constant time.

  9. Notice that all these Fibonacci heaps can be inherited in \(O(1)\) time by simply changing their reference from \(q_1\) to \(x\).

References

  1. Ackermann, W.: Zum hilbertschen aufbau der reellen zahlen. Math. Ann. 99, 118–133 (1928)

    Article  MATH  MathSciNet  Google Scholar 

  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)

    Article  MATH  MathSciNet  Google Scholar 

  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)

  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)

  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)

  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)

    Article  MATH  Google Scholar 

  7. Fredman, M.L., Tarjan, R.E.: Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM 34(3), 596–615 (1987)

    Article  MathSciNet  Google Scholar 

  8. Gfeller, B.: Faster swap edge computation in minimum diameter spanning trees. Algorithmica 62(1–2), 169–191 (2012)

    Article  MATH  MathSciNet  Google Scholar 

  9. Gualà, L., Proietti, G.: Exact and approximate truthful mechanisms for the shortest-paths tree problem. Algorithmica 49(3), 171–191 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  10. Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)

    Article  MATH  MathSciNet  Google Scholar 

  11. Italiano, G.F., Ramaswami, R.: Maintaining spanning trees of small diameter. Algorithmica 22(3), 275–304 (1998)

    Article  MATH  MathSciNet  Google Scholar 

  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)

  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)

  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)

    Article  MATH  MathSciNet  Google Scholar 

  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)

    Article  MathSciNet  Google Scholar 

  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)

  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)

  18. Tarjan, R.E.: Sensitivity analysis of minimum spanning trees and shortest path trees. Inf. Process. Lett. 14(1), 30–33 (1982)

    Article  MathSciNet  Google Scholar 

  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)

    Article  MATH  MathSciNet  Google Scholar 

Download references

Acknowledgments

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.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Guido Proietti.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Bilò, D., Gualà, L. & Proietti, G. A Faster Computation of All the Best Swap Edges of a Shortest Paths Tree. Algorithmica 73, 547–570 (2015). https://doi.org/10.1007/s00453-014-9912-6

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00453-014-9912-6

Keywords

Navigation