Abstract
Graph is a ubiquitous structure representing entities and their relationships applied in many areas such as social networks, web graphs, and biological networks. One of the fundamental tasks in graph analytics is to investigate the relations between two vertices (e.g., users, items and entities) such as how a vertex A influences another vertex B , or to what extent A and B are similar to each other, based on the graph topology structure. For this purpose, we study the problem of hop-constrained s-t simple path enumeration in this paper, which aims to list all simple paths from a source vertex s to a target vertex t with hop-constraint k. We first propose a polynomial delay algorithm, namely BC-DFS, based on barrier-based pruning technique. Then a join-oriented algorithm, namely JOIN, is designed to further enhance the query response time. On the theoretical side, BC-DFS is a polynomial delay algorithm with O ( km ) time per output where m is the number of edges in the graph. This time complexity is the same as the best known theoretical result for the polynomial delay algorithms of this problem. On the practical side, our comprehensive experiments on 15 real-life networks demonstrate the superior performance of the BC-DFS algorithm compared to the state-of-the-art techniques. It is also reported that the JOIN algorithm can further significantly enhance the query response time.
Introduction
In graph analytics, understanding the connectivity between two entities is fundamental. While finding the shortest path is computationally straightforward, enumerating all simple paths (paths without cycles) is significantly more challenging because the number of potential paths can grow exponentially with length. In practical applications—such as biological metabolic pathway analysis or financial fraud investigation—users typically focus on "short" paths defined by a hop constraint ($k$).
Even with a small $k$, the search space remains vast. Existing "polynomial delay" algorithms, which guarantee a limited time interval between outputting successive paths, often struggle in practice due to expensive validation checks at every step. Conversely, naive search methods frequently revisit "dead-end" branches, wasting computational resources. This paper introduces two novel algorithms, BC-DFS and JOIN, to bridge the gap between theoretical efficiency and practical performance.
Methodology
BC-DFS: Learning from Mistakes
The Barrier-based Constrained DFS (BC-DFS) algorithm enhances standard Depth-First Search with an adaptive pruning strategy. Its core principle is to avoid repeating failed search attempts. When the search fails to reach the target $t$ from a node $u$ within the remaining "hop budget," it records a barrier level ($u.bar$). This level represents the minimum number of hops required from $u$ to reach $t$.
As shown in Figure 2, if a future search branch reaches node $d$ with a remaining budget less than its barrier level (e.g., budget is 3 while $d.bar=5$), the search can be pruned immediately. This "learning" mechanism allows BC-DFS to maintain a theoretical complexity of $O(km)$ per output while significantly outperforming "pessimistic" algorithms that perform redundant checks.
JOIN: A Divide-and-Conquer Approach
Recognizing that DFS-based methods often repeat sub-path computations, the JOIN algorithm employs a join-oriented strategy. It identifies a "middle vertex cut"—a set of nodes that partition the paths between the source and target.
By finding partial paths from the source to the cut and from the cut to the target separately, and then joining them, the algorithm shares computation across many different paths. This approach is particularly effective as the hop constraint $k$ increases, where the overhead of joining is offset by the massive reduction in redundant exploration.
Experimental Evaluation
The algorithms were evaluated on 15 real-life networks, ranging from biological datasets (Reactome) to massive social graphs like Twitter(WWW) with 1.46 billion edges.
Key Results
- Performance Gain: BC-DFS consistently outperformed state-of-the-art polynomial delay algorithms by 1 to 2 orders of magnitude.
- Scalability: On the billion-scale Twitter graph, JOIN successfully answered queries for $k=6$ in approximately 5.7 hours, whereas all baseline algorithms failed to complete within 24 hours even for $k=3$.
- Efficiency: Despite the memory requirements typically associated with join operations, the implementation remained efficient, utilizing significantly less memory than index-based competitors.
Conclusion and Future Work
This work successfully aligns theoretical guarantees with practical efficiency for hop-constrained path enumeration. Key insights include the power of adaptive learning via barriers and the benefits of computation sharing through join operations.
Future research directions include optimizing these methods for dynamic graphs that change in real-time and extending the framework to handle more complex constraints, such as edge labels or weights. Additionally, the naturally parallelizable structure of the JOIN algorithm presents an opportunity for distributed implementations on even larger web-scale graphs.
Summary updated