K-best enumeration - theory and application
Date
2017
Authors
Journal Title
Journal ISSN
Volume Title
Publisher
Abstract
Where an optimal solution does not contain sufficient information about a given problem instance, enumerating good solutions is a common coping strategy. In combinatorial optimization, k-best enumeration, or ranking, has been studied and applied extensively. The k shortest simple path problem in directed, weighted graphs (kSSP), introduced in 1963 by Clarke, Krikorian and Rausen, is particularly well known. Efficient existing algorithms are based on Yen's algorithm for this problem; they all feature a worst-case running time of O(kn(m + n log n)) on a graph with n vertices and m edges. Vassilevska Williams and Williams show that a polynomially faster kSSP algorithm would also result in an algorithm for the all-pairs shortest path problem with running time O(n\^{3-ε}), which seems unlikely at the moment.
We present a kSSP algorithm that is not based on Yen's algorithm, matching the state-of-the-art running time of O(kn(m + n log n)). In particular, we do not solve a single instance of the replacement path problem, a basic building block of Yen's algorithm. Instead, we make use of ideas used in Eppstein's algorithm for a similar problem where paths are allowed to be non-simple. Using our algorithm, one may find Θ(m) simple paths with a single shortest path tree computation and additional O(m + n) time per path in well-behaved cases. We also propose practical improvements for our algorithm, comprising dynamic edge pruning, lazy shortest path tree computations, and fast path simplicity checks. In a detailed computational study, we demonstrate that well-behaved cases are quite common in random graphs, grids and road networks. We showcase usefulness of the dynamic edge pruning approach on those three graph classes and on network topology graphs. Despite 40 years of heavy research on Yen-based kSSP algorithms, including involved algorithm engineering, our algorithm proves to be faster than existing algorithms by at least an order of magnitude.
However, there is not much room for improvement for the general worst case. We demonstrate that kSSP can be solved considerably faster if the input graph is restricted to have bounded treewidth. Specifically, we propose an algorithm template for enumerating the k best solutions in a bounded treewidth graph for any problem that can be expressed in counting monadic second-order logic. Our template is a generalization of Courcelle's theorem, mainly utilizing dynamic programming and a persistent heap data structure. It enumerates any constant amount of solutions in time O(n). For general k, it requires O(log n) extra time per solution, resulting in a total running time of O(n + k log n). Finding the initial solution is parallelizable, so the linear term can be dropped and we obtain a running time of O(k log n) in the PRAM model. The class of problems expressible in counting monadic second order logic contains kSSP, matching problems, or the spanning tree problem, but also a number of NP-hard problems like the traveling salesman problem, where we achieve a doubly-exponential speedup.
Description
Table of contents
Keywords
K-best, Ranking, Directed graphs, Hypergraph, Graph algorithms, Shortest path, Bounded treewidth, Parameterized complexity, Algorithm engineering, Computational studies, Counting monadic second-order logic