This paper leverages the framework of algorithms-with-predictions to design data structures for two fundamental dynamic graph problems: incremental topological ordering and cycle detection. In these problems, the input is a directed graph on $n$ nodes, and the $m$ edges arrive one by one. The data structure must maintain a topological ordering of the vertices at all times and detect if the newly inserted edge creates a cycle. The theoretically best worst-case algorithms for these problems have high update cost (polynomial in $n$ and $m$). In practice, greedy heuristics (that recompute the solution from scratch each time) perform well but can have high update cost in the worst case. In this paper, we bridge this gap by leveraging predictions to design a learned new data structure for the problems. Our data structure guarantees consistency, robustness, and smoothness with respect to predictions -- that is, it has the best possible running time under perfect predictions, never performs worse than the best-known worst-case methods, and its running time degrades smoothly with the prediction error. Moreover, we demonstrate empirically that predictions, learned from a very small training dataset, are sufficient to provide significant speed-ups on real datasets.
翻译:本文利用基于预测的算法框架,为两个基础性动态图问题设计数据结构:增量拓扑排序与环检测。在这些问题中,输入为一个包含 $n$ 个节点的有向图,$m$ 条边依次加入。数据结构必须始终维护顶点的拓扑序,并检测新插入的边是否形成环。针对这些问题,理论上最坏情况最优算法具有较高的更新代价(关于 $n$ 和 $m$ 的多项式级)。在实践中,贪婪启发式算法(每次从头重新计算解)表现良好,但在最坏情况下可能产生较高更新代价。本文通过利用预测来弥合这一差距,为这些问题设计了一种新型学习数据结构。该数据结构在预测方面保证了一致性、鲁棒性和平滑性 —— 即在完美预测下具有最优运行时间,在表现上始终不劣于已知最坏情况方法,且其运行时间随预测误差平滑退化。此外,我们通过实验证明,从极小训练数据集学习得到的预测足以在真实数据集上实现显著加速。