Shortest Beer Path Queries Based on Graph Decomposition

Authors Tesshu Hanaka , Hirotaka Ono , Kunihiko Sadakane , Kosuke Sugiyama

Thumbnail PDF


  • Filesize: 2.15 MB
  • 20 pages

Document Identifiers

Author Details

Tesshu Hanaka
  • Faculty of Information Science and Electrical Engineering, Kyushu University, Fukuoka, Japan
Hirotaka Ono
  • Graduate School of Informatics, Nagoya University, Japan
Kunihiko Sadakane
  • Graduate School of Information Science and Technology, The University of Tokyo, Japan
Kosuke Sugiyama
  • Graduate School of Informatics, Nagoya University, Japan

Cite AsGet BibTex

Tesshu Hanaka, Hirotaka Ono, Kunihiko Sadakane, and Kosuke Sugiyama. Shortest Beer Path Queries Based on Graph Decomposition. In 34th International Symposium on Algorithms and Computation (ISAAC 2023). Leibniz International Proceedings in Informatics (LIPIcs), Volume 283, pp. 37:1-37:20, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)


Given a directed edge-weighted graph G = (V, E) with beer vertices B ⊆ V, a beer path between two vertices u and v is a path between u and v that visits at least one beer vertex in B, and the beer distance between two vertices is the shortest length of beer paths. We consider indexing problems on beer paths, that is, a graph is given a priori, and we construct some data structures (called indexes) for the graph. Then later, we are given two vertices, and we find the beer distance or beer path between them using the data structure. For such a scheme, efficient algorithms using indexes for the beer distance and beer path queries have been proposed for outerplanar graphs and interval graphs. For example, Bacic et al. (2021) present indexes with size O(n) for outerplanar graphs and an algorithm using them that answers the beer distance between given two vertices in O(α(n)) time, where α(⋅) is the inverse Ackermann function; the performance is shown to be optimal. This paper proposes indexing data structures and algorithms for beer path queries on general graphs based on two types of graph decomposition: the tree decomposition and the triconnected component decomposition. We propose indexes with size O(m+nr²) based on the triconnected component decomposition, where r is the size of the largest triconnected component. For a given query u,v ∈ V, our algorithm using the indexes can output the beer distance in query time O(α(m)). In particular, our indexing data structures and algorithms achieve the optimal performance (the space and the query time) for series-parallel graphs, which is a wider class of outerplanar graphs.

Subject Classification

ACM Subject Classification
  • Theory of computation → Data structures design and analysis
  • graph algorithm
  • shortest path problem
  • SPQR tree


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Joyce Bacic, Saeed Mehrabi, and Michiel Smid. Shortest beer path queries in outerplanar graphs. Algorithmica, 85(6):1679-1705, 2023. Google Scholar
  2. Omer Berkman and Uzi Vishkin. Recursive star-tree parallel data structure. SIAM Journal on Computing, 22(2):221-242, 1993. Google Scholar
  3. Hans L Bodlaender. Treewidth: Algorithmic techniques and results. In Mathematical Foundations of Computer Science 1997: 22nd International Symposium, MFCS'97 Bratislava, Slovakia, August 25-29, 1997 Proceedings 22, pages 19-36. Springer, 1997. Google Scholar
  4. Bernard Chazelle. Computing on a free tree via complexity-preserving mappings. Algorithmica, 2(1-4):337-361, 1987. Google Scholar
  5. Rathish Das, Meng He, Eitan Kondratovsky, J. Ian Munro, Anurag Murty Naredla, and Kaiyu Wu. Shortest Beer Path Queries in Interval Graphs. In Sang Won Bae and Heejin Park, editors, 33rd International Symposium on Algorithms and Computation (ISAAC 2022), volume 248 of Leibniz International Proceedings in Informatics (LIPIcs), pages 59:1-59:17, Dagstuhl, Germany, 2022. Schloss Dagstuhl - Leibniz-Zentrum für Informatik. Google Scholar
  6. Arash Farzan and Shahin Kamali. Compact navigation and distance oracles for graphs with small treewidth. Algorithmica, 69(1):92-116, 2014. Google Scholar
  7. Michael L Fredman and Robert Endre Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms. Journal of the ACM (JACM), 34(3):596-615, 1987. Google Scholar
  8. Carsten Gutwenger and Petra Mutzel. A linear time implementation of SPQR-trees. In Joe Marks, editor, Graph Drawing, pages 77-90, Berlin, Heidelberg, 2001. Springer Berlin Heidelberg. Google Scholar
  9. J. E. Hopcroft and R. E. Tarjan. Dividing a graph into triconnected components. SIAM Journal on Computing, 2(3):135-158, 1973. Google Scholar
  10. Manas Jyoti Kashyop, Tsunehiko Nagayama, and Kunihiko Sadakane. Faster algorithms for shortest path and network flow based on graph decomposition. J. Graph Algorithms Appl., 23(5):781-813, 2019. Google Scholar
  11. Mikkel Thorup. Undirected single-source shortest paths with positive integer weights in linear time. Journal of the ACM (JACM), 46(3):362-394, 1999. Google Scholar