Shortest Beer Path Queries in Interval Graphs

Rathish Das, Meng He, Eitan Kondratovsky, J. Ian Munro, Anurag Murty Naredla, Kaiyu Wu

Abstract

This paper investigates the problem of finding the shortest path between two vertices in an interval graph that is constrained to pass through at least one designated "beer vertex." We propose succinct data structures that achieve near-optimal space complexity while supporting efficient distance and path retrieval queries. For proper interval graphs, we provide a structure using $3n + o(n)$ bits, which is remarkably close to the established information-theoretic lower bound of approximately $2.9n$ bits.

1. Introduction

In graph theory, the shortest path problem is a fundamental building block for navigation and network analysis. However, many real-world applications require paths that satisfy specific constraints, such as visiting a point of interest (POI) along the way. This paper formalizes the "Beer Path" problem: given a graph $G = (V, E)$ and a subset of vertices $B \subseteq V$ (designated as beer stores), find the shortest path between a source $u$ and a destination $v$ that includes at least one vertex $b \in B$.

While this problem can be solved using standard algorithms, the challenge lies in designing succinct data structures—representations that use space close to the information-theoretic minimum—while maintaining high query performance. We focus specifically on interval graphs, which represent the intersection of intervals on a real line, and their subclass, proper interval graphs (where no interval is contained within another).

2. Methodology

Our approach leverages the geometric properties of interval graphs to transform graph-theoretic distances into spatial and hierarchical queries.

2.1 Distance Trees and Path Decomposition

A shortest beer path can be decomposed into two standard shortest paths: one from the source $u$ to a beer vertex $b$, and another from $b$ to the destination $v$. The core challenge is identifying the specific $b \in B$ that minimizes the total distance $dist(u, b) + dist(b, v)$. We utilize a distance tree representation, where a bijection exists between graph vertices and tree nodes, allowing us to map graph distances to tree-based operations.

2.2 Orthogonal Range Searching

To efficiently locate the optimal beer vertex, we treat the problem as a multi-dimensional range query. By mapping beer nodes to points in a 2D or 3D coordinate system based on their tree properties (such as post-order rank and depth), we can employ specialized "range emptiness" data structures. In proper interval graphs, the set of nodes that preserve the shortest distance between two points forms a predictable geometric region in the distance tree, enabling us to use 2D range searching to identify the optimal $b$.

2.3 Succinct Encoding

We employ advanced bit-vector techniques, specifically rank and select operations, to compress the graph information. This allows the structure to occupy $O(n)$ bits while still supporting fast traversal and distance calculation. For proper interval graphs, we use Dyck paths and combinatorial analysis to optimize the bit-count.

3. Theoretical Results

3.1 General Interval Graphs

For general interval graphs, we present a data structure requiring $2n \log n + O(n) + O(|B| \log n)$ bits. This structure supports:

  • Distance Queries: $O(\log^\epsilon n)$ time.
  • Path Retrieval: $O(\log^\epsilon n + d)$ time, where $d$ is the path length.

3.2 Proper Interval Graphs

Proper interval graphs allow for significantly more compact representations. We achieved a space bound of $3n + o(n)$ bits. Queries for distance are performed in $O(f(n) \log n)$ time (where $f(n)$ is any slow-growing function), and full path retrieval is achieved in $O(d)$ time.

3.3 Lower Bound Analysis

Using the Polya Enumeration Theorem, we established that any data structure for beer proper interval graphs requires at least $\log(4 + 2\sqrt{3})n \approx 2.9n$ bits. Our $3n$-bit structure is thus nearly optimal, demonstrating that adding beer constraints only minimally increases the storage requirements compared to standard proper interval graphs (which require $2n$ bits).

4. Discussion and Limitations

While our structures provide near-optimal space for unweighted interval graphs, several avenues for future research remain:

  • Weighted Graphs: The current methodology assumes all edges have a weight of 1. Extending these succinct structures to weighted graphs is a non-trivial challenge.
  • Dynamic Updates: Our structures are static. Developing a version that allows for the dynamic addition or removal of beer stores or intervals would enhance real-world utility.
  • Query Efficiency: There is an inherent trade-off between the space complexity's dependence on the number of beer vertices $|B|$ and the resulting query time. Future work may focus on further reducing query latency without expanding the space footprint.

Summary updated

BibTeX
@inproceedings{das2022shortest,
  author = {Rathish Das and Meng He and Eitan Kondratovsky and J. Ian Munro and Anurag Murty Naredla and Kaiyu Wu},
  title = {{Shortest Beer Path Queries in Interval Graphs}},
  booktitle = {ISAAC},
  year = {2022},
  doi = {10.4230/lipics.isaac.2022.59},
}
Figure