Incremental Topological Ordering and Cycle Detection with Predictions

Samuel McCauley, Benjamin Moseley, Aidin Niaparast, Shikha Singh
2/12/2026

No confident code implementation found for this paper.

Abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{mccauley2026incremental,
  title  = {Incremental Topological Ordering and Cycle Detection with Predictions},
  author = {Samuel McCauley and Benjamin Moseley and Aidin Niaparast and Shikha Singh},
  year   = {2026},
  eprint = {2402.11028},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2402.11028},
  journal = {ICML 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2402.11028.svg)](https://codeofpaper.com/paper/2402.11028)

Discussion