Abstract
A beer graph is an undirected graph G, in which each edge has a positive weight and some vertices have a beer store. A beer path between two vertices u and v in G is any path in G between u and v that visits at least one beer store. We show that any outerplanar beer graph G with n vertices can be preprocessed in O(n) time into a data structure of size O(n), such that for any two query vertices u and v, (i) the weight of the shortest beer path between u and v can be reported in \(O(\alpha (n))\) time (where \(\alpha (n)\) is the inverse Ackermann function), and (ii) the shortest beer path between u and v can be reported in O(L) time, where L is the number of vertices on this path. Note that the running time for (ii) does not depend on the number of vertices of G. Both results are optimal, even when G is a beer tree (i.e., a beer graph whose underlying graph is a tree).
Similar content being viewed by others
Notes
To apply Lemma 2, we consider each vertex of G to be a color. For each vertex v of G, the v-colored path in the tree D(G) is the path \(P_v\). The face \(F_1\) is the answer to the closest-color query with nodes \(F_s\) and \(F_t\) and color s.
We do not have to consider \(W := \omega (u,v) + \textsf{dist}_B(v,w,G_{vw}^{\lnot R}) + \omega (w,u)\), because the sum of the values in ii. and iii. is at most 2W. Therefore, the smaller of the values in ii. and iii. is at most W.
References
Alon, N., Schieber, B.: Optimal preprocessing for answering on-line product queries. Technical Report 71/87, Tel-Aviv University, (1987)
Bender, M.A., Farach-Colton, M.: The LCA problem revisited. In: Proceedings of the 4th Latin American Symposium on Theoretical Informatics, volume 1776 of Lecture Notes in Computer Science, pp. 88–94. Springer, Berlin (2000)
Chan, T.M., He, M., Munro, J.I., Zhou, G.: Succinct indices for path minimum, with applications. Algorithmica 78(2), 453–491 (2017)
Chazelle, B.: Computing on a free tree via complexity-preserving mappings. Algorithmica 2, 337–361 (1987)
Djidjev, H., Pantziou, G.E., Zaroliagis, C.D.: Computing shortest paths and distances in planar graphs. In: Automata, Languages and Programming, 18th International Colloquium, ICALP91, volume 510 of Lecture Notes in Computer Science, pp. 327–338. Springer (1991)
Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)
Maheshwari, A., Zeh, N.: I/o-optimal algorithms for outerplanar graphs. J. Graph Algorithms Appl. 8(1), 47–87 (2004)
Pettie, S.: An inverse-Ackermann type lower bound for online minimum spanning tree verification. Combinatorica 26(2), 207–230 (2006)
Thorup, M.: Parallel shortcutting of rooted trees. J. Algorithms 32, 139–159 (1997)
Funding
Joyce Bacic was supported by an NSERC Undergraduate Student Research Award. Michiel Smid was suported by NSERC.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The authors declare they have no conflict of interest.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
A preliminary version was presented at the 32nd Annual International Symposium on Algorithms and Computation (ISAAC 2021). JB was supported by an NSERC Undergraduate Student Research Award. MS was suported by NSERC.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Bacic, J., Mehrabi, S. & Smid, M. Shortest Beer Path Queries in Outerplanar Graphs. Algorithmica 85, 1679–1705 (2023). https://doi.org/10.1007/s00453-022-01045-4
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-022-01045-4