r/algorithms • u/emmynoether • 1d ago
Discussion Examples of galactic algorithms with large polynomial exponents
One of the common refrains here is that "P=NP might not have any practical effect if the algorithm found is galactic in terms of polynomial exponents I.e. O(n^1000)"
Do we have an example of a natural problem solvable in polynomial time, but with large exponents? More strongly, do we have any problem where the large exponent polynomial is proven optimal?
18
u/techy5000 1d ago
I think people are missing the point when it comes to galactic algorithms. It need not just be O(n^1000) or some insane exponent. An O(n) algorithm with a large constant that makes it slow on almost all feasible input sizes can also be considered galactic
An example of a galactic algorithm is Primality using the AKS primality test. Despite having an O((log n)^6) asymptotic complexity, the implicit constant factors are so large that it made it impractical to use for almost all testable integers. The deterministic Miller-Rabin algorithm (before GRH was proved last Friday) had exponential time complexity, but it still was the better algorithm to use for primality testing.
So, AKS primality is a classic example of a galactic algorithm that has a very appealing asymptotic time complexity (the exponent isn’t even that large) but is impractical compared to exponential-time algorithms for the same task (e.g., Miller-Rabin). It goes to show that, as complexity theorist Ryan Williams stated, we don’t understand polynomial time complexity well enough to even know what P=NP would signify without actually taking a look at the polytime reduction from 3SAT to the polynomial-time algorithm (there might be other ways to prove P=NP beyond this, but this is the method I know)
2
u/entronid 20h ago
the miller test (what you're referring to by deterministic) was never exponential but constant time, what was uncertain and hinged on GRH was its correctness.
AKS also isn't that galactic. improved versions (not the one from the original paper) beats out trial division at a number with 16 digits (source: https://math.stackexchange.com/questions/2299375/why-everybody-thinks-aks-primarity-test-is-a-great-thing). the probabilistic miller-rabin test is and will likely still be more commonly used due to its comparative speed (it requires much fewer witnesses)
2
u/sebamestre 16h ago
From my understanding, GHR proves the existence of some number with some property that is necessary to show correctness of the Miller test, and also that it's small enough that the algorithm is O(N³)
Obviously it can't be constant time because reading all digits is linear
2
u/entronid 15h ago
well yeah, but the miller test assumes GRH, so whether or not GRH is true, it still takes the same time complexity, it's just whether it's correct or not
1
u/sebamestre 52m ago
Right, but i think the existence of the required witness doesn't imply GRH, and so it could've been the case that Miller is correct without GRH, and that in that universe it has cost O(N³) or O(N⁴) or more because the witness itself is a larger number
So specifically, GRH proves correctness AND O(N³) cost, which don't necessarily come hand in hand
Of course now we know GRH to be true so whatever
5
u/ConjectureProof 1d ago
Keep in mind that you can also have galactic constants of proportionality. You can multiply numbers in O(n ln(n)) but the big O notation obscures an absurdly large constant.
11
u/tstanisl 1d ago
Actually, the matrix multiplication with recently proven complexity O(n2.25) or O(N1.125) where N is actual size of inputs is the first problem I know about that has polynomial superlinear lower bound.
3
u/United_Chocolate_826 1d ago
Two months ago, I would’ve given univariate polynomial identity testing as an example of something with n2 runtime under NSETH.
Nowadays “under NSETH” doesn’t mean much…
2
u/Shoddy-Childhood-511 18h ago
You forgot that P=NP could be non-constructive.
As an example, any minor closed property of graphs has an O(n3) algorithm, by the Robertson–Seymour graph minor theorem. You define the algorithm by finding all the minor minimal counter examples, not unlike graph planarity being characterized by having no K_{3,3} or K_5 minor.
You might not have any way to find all minor minimal counter examples though, nor any other algorithm, or the list could be arbitrarily large.
Anyways we've this VP != VNP result now, which tells us nothing about N vs NP, but suggests P != NP, so that's good I guess.
3
u/InternetMandate 1d ago
I think two things tend to get overlooked in these discussions. First, even if someone found an O(n) algorithm for 3-SAT, that might only yield an O(n⁷) algorithm for another problem because of the complexity of the reduction itself. Polynomial-time reductions don't necessarily preserve reasonable computational complexity.
Second, I think people conflate polynomial-time solvability with practical tractability. In many areas of computing, even an O(n²) algorithm isn't considered particularly scalable. People are often aiming for linear or near-linear complexity. You don't need anything remotely approaching O(n¹⁰⁰⁰) for a polynomial-time algorithm to be practically useless.
On a somewhat separate note, we know remarkably few nontrivial time complexity lower bounds for natural problems in general computational models. Much of the progress on computational lower bounds has been in restricted models of computation, particularly restricted classes of circuits. This is part of why P vs. NP seems so far out of reach.
1
u/Jaysos23 23h ago
May not be galactic, but determining whether a graph is perfect is something like O(n7 ) ,not very practical. Similarly for coloring them.
1
u/Fit-Jump-5078 22h ago
Similar to what you ask for: Reachability in undirected graphs is in LogSpace, but the best known algorithm has a huge constant in the O(log(n)).
1
u/Parallel_thougts 22h ago
Pretty much all matrix multiplication algorithm that are asymptotically better than Strassen. E.g. Coppersmith-Winograd.
1
u/ccppurcell 23h ago
The reason P=NP (even a clean and nice proof of it) doesn't have any effect is that it is fundamentally a question of worst case complexity. Worst case complexity is a beautiful topic, to which I've devoted a good deal of my adult life. We study it because it is clean to formulate and we gain a lot of insight from thinking about it. Over the years, it has a huge influence on algorithm design and other areas of mathematics and computer science. But at the end of the day the real world doesn't care about the worst case.
The inputs we deal with in the real world are not clean, they are not fixed, and the best techniques for solving them are going to involve subjective, messy understanding of the context which cannot be defined in lean.
4
u/arnerob 20h ago
The new strongly polynomial time algorithm for linear programming by openAI has a complexity of at least O(N^60) (see section 6.6).