Generalized sorting: sorting with comparisons allowed only along a graph
Sort n items when only pairs joined by edges of a given graph can be compared. Accepted bound: about n^(3/2) comparisons; two November 2026 preprints claim n^(4/3) and n·polylog n.
On this page13 sections
It is the cleanest model of sorting under restricted or priced comparisons, and it is a testbed for query-complexity techniques (sampling, prediction repair) that apply to other problems where information is only available through a constrained set of probes.
Sorting when you may compare only pairs of items joined by an edge of a given graph.
- 1Compare only along edges of a graph
- 2Hidden order lies on a path in it
- 3Sample edges, predict all directions
- 4Repair prediction with few comparisons
- 5Total near n log n claimed, unrefereed
The model. There are items with a hidden total order. A known graph says which pairs can be compared, and one comparison on an edge reveals which endpoint is smaller. The graph contains a Hamiltonian path in sorted order, so the order is recoverable. The cost is the number of comparisons. For the complete graph the problem is ordinary comparison sorting, which needs comparisons: there are possible orders and each answer at best halves the possibilities, so at least answers are needed.
Why it is harder in general. A comparison along an edge settles only that edge. With a sparse graph one can compare along every edge, costing comparisons for edges. With a dense graph the interesting question is how to choose which few edges to ask about, using the answers to infer others. If and are answered, then the edge , if present, is known without asking. The difficulty is that the useful chains may be hidden among many edges that look alike.
Known results. Randomized algorithms by Huang, Kannan and Khanna use about comparisons (2011); Kuszmaul and Narayanan reach and an optimal bound on random graphs (2021); sorting with predictions needs comparisons when a guess with errors is given (2020). Two preprints from November 2026 claim (Behnezhad and Ferrante) and (Khanna, Putterman and Song). Neither is refereed and DARC has not checked either.
Why it matters beyond sorting. The model is a clean testbed for query complexity: how much must be asked when answers come only through a restricted door. The prediction-then-repair idea (guess everything cheaply, then fix the mistakes with a budget proportional to the number of mistakes) is a general pattern.
Go deeper
The full technical text.
The model
There are items with a hidden total order . A known undirected graph on the items says which pairs may be compared; one comparison of an edge reveals which of is smaller. The graph is promised to contain a Hamiltonian path that visits the items in sorted order, so the order can in principle be recovered (without it, items with no comparable chain between them could not be ranked). The cost is the number of comparisons made, which may be chosen adaptively. When is the complete graph this is ordinary comparison sorting, which needs comparisons; so is a lower bound for every , and it is the only general lower bound on record.
The model goes back to sorting with priced or forbidden comparisons (Charikar et al., 2000); Huang, Kannan and Khanna studied it as generalized sorting (FOCS 2011).
What was known
Trivially, comparisons suffice (compare along every edge). Huang, Kannan and Khanna gave a randomized algorithm with comparisons, and asked whether comparisons are needed for some constant . Kuszmaul and Narayanan (FOCS 2021) improved this to for edges, which is no gain on dense graphs, and gave an optimal expected-comparison algorithm for Erdos-Renyi random graphs with the Hamiltonian path added. Lu, Ren, Sun and Zhang studied sorting with predictions: given a guessed orientation of every edge with mistakes, comparisons suffice.
The November 2026 preprints (unrefereed)
- Behnezhad and Ferrante, Generalized Sorting via Four-Cycles (arXiv:2611.06745, v1 4 November 2026) claim comparisons on every graph, breaking the barrier, by querying edges that lie in many four-cycles and inferring the directions of the opposite edges.
- Khanna, Putterman and Song, A Near-Optimal Generalized Sorting Algorithm (arXiv:2611.08397, v1 5 November 2026) claim a randomized algorithm using comparisons in expectation on every graph. Their method builds a prediction of all edge orientations with expected errors through repeated sampling and error-isolation passes, then repairs it with the Lu et al. prediction-repair algorithm. The authors state that an OpenAI model (ChatGPT "6-Astra") was essential to the improved bounds.
Neither preprint is refereed and DARC has not checked either argument. If the second holds, the answer to the Huang-Kannan-Khanna question is no.
What would remain open
Even then: whether comparisons suffice on every graph (a factor separates the claim from the only lower bound), what the deterministic complexity is, and whether near-linear comparison counts can be reached by polynomial-time algorithms (the new algorithm is reported not to be). Lower bounds beyond are unknown for any graph family.
Words on this page (7)
- graph
- A set of points (vertices) with some pairs joined by lines (edges).
- total order
- A ranking in which any two items can be compared, so every item has a definite place in a single line.
- comparison sort
- A sorting method that learns the order only by asking which of two items is smaller.
- Hamiltonian path
- A route through a graph that visits every vertex exactly once.
- big-O notation
- A way to say how fast a quantity grows, ignoring constant factors; O(n log n) grows far slower than n squared.
- randomized algorithm
- A method that makes random choices, so its cost is judged on average over those choices.
- sorting algorithm
- A procedure that rearranges a list into order, such as smallest to largest.
New to this? Read first (4)
- Sorting algorithm (Wikipedia)Background on the ordinary problem before restrictions are added.
- Comparison sort (Wikipedia)Explains the n log n lower bound for sorting by comparisons.
- Kuszmaul, Narayanan, Stochastic and Worst-Case Generalized Sorting RevisitedA readable introduction to the generalized sorting model with earlier results.
- Lu, Ren, Sun, Zhang, Generalized Sorting with PredictionsShort paper on the prediction-repair idea that the 2026 claim builds on.
Understanding map
map of the whole wiki →What to read before Generalized sorting: sorting with comparisons allowed only along a graph (left), and what builds on it: entries that depend on it and its open problems (right). Every box links to its page.
- Start with
- Step 2
- Step 3
- Then
Open problems & questions
Progress timeline
- Nov 5, 2026Claimed O(n log^4 n) comparisons (preprint)Related to: Generalized sorting: is n·polylog n comparisons enough, and what is the exact complexity?source
Khanna, Putterman and Song posted arXiv:2611.08397 (v1, 5 November 2026). Unrefereed; DARC has not checked it.
- Nov 5, 2026Claimed O(n log^4 n) comparisons (preprint)source
Khanna, Putterman and Song posted arXiv:2611.08397 (v1, 5 November 2026). Unrefereed; DARC has not checked it.
- Nov 4, 2026Claimed Õ(n^(4/3)) via four-cycles (preprint)source
Behnezhad and Ferrante posted arXiv:2611.06745 (v1, 4 November 2026). Unrefereed.
- Nov 4, 2026Claimed Õ(n^(4/3)) via four-cycles (preprint)Related to: Generalized sorting: is n·polylog n comparisons enough, and what is the exact complexity?source
Behnezhad and Ferrante posted arXiv:2611.06745 (v1, 4 November 2026). Unrefereed.
- Nov 14, 2021Õ(sqrt(mn)) comparisons; optimal for random graphsRelated to: Generalized sorting: is n·polylog n comparisons enough, and what is the exact complexity?source
Kuszmaul and Narayanan (FOCS 2021) gave O(n log(np)) expected comparisons for random graphs and Õ(sqrt(mn)) in general.
- Nov 14, 2021Õ(sqrt(mn)) comparisons; optimal for random graphssource
Kuszmaul and Narayanan (FOCS 2021) gave O(n log(np)) expected comparisons for random graphs and Õ(sqrt(mn)) in general.
- Oct 31, 2020Sorting with predictions: O(n log n + w)Related to: Generalized sorting: is n·polylog n comparisons enough, and what is the exact complexity?source
Lu, Ren, Sun and Zhang showed that a prediction of every edge with w errors can be repaired with O(n log n + w) comparisons, the tool later reused.
- Oct 31, 2020Sorting with predictions: O(n log n + w)source
Lu, Ren, Sun and Zhang showed that a prediction of every edge with w errors can be repaired with O(n log n + w) comparisons, the tool later reused.
- Oct 1, 2011Generalized sorting in Õ(n^(3/2)) comparisonssource
Huang, Kannan and Khanna (FOCS 2011; the date is a placeholder for the symposium month) gave a randomized algorithm using about min(m, n^(3/2)) comparisons and asked whether n^(1+eps) is necessary. Bound as quoted in the later papers cited here.
- Oct 1, 2011Generalized sorting in Õ(n^(3/2)) comparisonsRelated to: Generalized sorting: is n·polylog n comparisons enough, and what is the exact complexity?source
Huang, Kannan and Khanna (FOCS 2011; the date is a placeholder for the symposium month) gave a randomized algorithm using about min(m, n^(3/2)) comparisons and asked whether n^(1+eps) is necessary. Bound as quoted in the later papers cited here.